Exemple #1
0
 async def cog_command_error(self, ctx, error):
     msg = sanitize(error)
     await ctx.send(msg)
     text = type(error).__name__ + ": " + msg
     logger.error(text)
     logger.error(traceback.format_exc())
     await ctx.send_help(ctx.command)
     await self.cog_after_invoke(ctx)
Exemple #2
0
 def _create_dir(self, _dir):
     try:
         os.mkdir(_dir)
     except OSError:
         logger.error(
             "Coulndn't create directory for output {}".format(_dir))
         logger.error("{}".format(traceback.format_exc()))
         print(
             "Couldn't create the directory {} for output. Please contact ERNW's team."
             .format(_dir))
Exemple #3
0
 def select_data(self, sql):
     try:
         self.cursor.execute(sql)
     except Exception as e:
         logger.error(e)
         return e
     else:
         return self.cursor.fetchall()
     finally:
         self.close()
Exemple #4
0
 def change_data(self, sql):
     try:
         self.cursor.execute(sql)
         self.db.commit()
         return 0
     except Exception as e:
         self.db.rollback()
         logger.error(e)
         return e
     finally:
         self.close()
Exemple #5
0
      Pros:
      - All your players are AV8
      - More money left for Apo after first match
      - Very safe, no players who you don't want SPP on
      
      Cons:
      - No witch till about game 3/4
      - Less MV7 on the team, you're noticeably slower to move over the pitch
      """

        await message.channel.send(msg)


cogs_dir = os.path.join(ROOT, 'cogs')
# Here we load our extensions(cogs) that are located in the cogs directory. Any file in here attempts to load.
if __name__ == '__main__':
    for extension in [
            f.replace('.py', '') for f in os.listdir(cogs_dir)
            if os.path.isfile(os.path.join(cogs_dir, f))
    ]:
        try:
            logger.info(f'Loading cog {extension}')
            bot.load_extension("cogs." + extension)
        except (discord.ClientException, ModuleNotFoundError):
            logger.error(f'Failed to load extension {extension}.')

with open(os.path.join(ROOT, 'config/TOKEN'), 'r') as token_file:
    TOKEN = token_file.read()

bot.run(TOKEN, bot=True, reconnect=True)