diff --git a/bot.py b/bot.py index f515ff4..c88a05a 100644 --- a/bot.py +++ b/bot.py @@ -34,6 +34,7 @@ opts = {'command_prefix': config.commandPrefix, 'pm_help': None, 'shard_count': config.shard_count, 'shard_id': config.shard_id} + bot = commands.Bot(**opts) discord_logger = logging.getLogger('discord') discord_logger.setLevel(logging.WARNING) @@ -46,8 +47,9 @@ log.addHandler(handler) @bot.event async def on_ready(): + print("We have connected") # Change the status upon connection to the default status - await bot.change_status(discord.Game(name=config.defaultStatus, type=0)) + await bot.change_status(discord.Game(name=config.default_status, type=0)) channel_id = config.get_content('restart_server') # Just in case the bot was restarted while someone was battling, clear it so they do not get stuck @@ -128,6 +130,8 @@ async def on_command_error(error, ctx): if __name__ == '__main__': + print("Loading extensions") for e in extensions: bot.load_extension(e) - bot.run(config.botToken) + print("Running bot") + bot.run(config.bot_token) diff --git a/cogs/utils/config.py b/cogs/utils/config.py index abecade..f2dc3cc 100644 --- a/cogs/utils/config.py +++ b/cogs/utils/config.py @@ -13,6 +13,21 @@ except FileNotFoundError: print("You have no config file setup! Please use config.yml.sample to setup a valid config file") quit() + +try: + bot_token = global_config["bot_token"] +except KeyError: + print("You have no bot_token saved, this is a requirement for running a bot.") + print("Please use config.yml.sample to setup a valid config file") + quit() + +try: + owner_ids = global_config["owner_id"] +except KeyError: + print("You have no owner_id saved! You're not going to be able to run certain commands without this.") + print("Please use config.yml.sample to setup a valid config file") + quit() + # Default bot's description botDescription = global_config.get("description") # Bot's default prefix for commands @@ -30,33 +45,19 @@ shard_id = global_config.get('shard_id', '') # A list of all the outputs for the battle command battleWins = global_config.get("battleWins", []) # The default status the bot will use -defaultStatus = global_config.get("default_status", "") +default_status = global_config.get("default_status", "") # The steam API key steam_key = global_config.get("steam_key", "") # The rethinkdb hostname -db_host = global_config.get('db_host', '') +db_host = global_config.get('db_host', 'localhost') # The rethinkdb database name -db_name = global_config.get('db_name', '') +db_name = global_config.get('db_name', 'Discord_Bot') # The rethinkdb certification -db_cert = global_config.get('db_cert', 'localhost') +db_cert = global_config.get('db_cert', '') # The rethinkdb port db_port = global_config.get('db_port', 28015) -try: - botToken = global_config["bot_token"] -except KeyError: - print("You have no bot_token saved, this is a requirement for running a bot.") - print("Please use config.yml.sample to setup a valid config file") - quit() - -try: - owner_ids = global_config["owner_id"] -except KeyError: - print("You have no owner_id saved! You're not going to be able to run certain commands without this.") - print("Please use config.yml.sample to setup a valid config file") - quit() - def save_content(key: str, content): try: