def loading_cog(self): """Loads the cog""" cogs = ("error_handler", "find_bot", "useful", "helpful", "myself", "eros", "jishaku") for cog in cogs: ext = "cogs." if cog != "jishaku" else "" if error := call(self.load_extension, f"{ext}{cog}", ret=True): print_exception( 'Ignoring exception while loading up {}:'.format(cog), error) else: print(f"cog {cog} is loaded")
def loading_cog(self): """Loads the cog""" cogs = () for file in os.listdir("cogs"): if file.endswith(".py"): cogs += (file[:-3],) cogs += ("jishaku",) for cog in cogs: ext = "cogs." if cog != "jishaku" else "" if error := call(self.load_extension, f"{ext}{cog}", ret=True): print_exception('Ignoring exception while loading up {}:'.format(cog), error) else: print(f"cog {cog} is loaded")
def starter(self): """Starts the bot properly""" try: print("Connecting to database...") start = time.time() pool_pg = self.loop.run_until_complete(asyncpg.create_pool(database=self.db, user=self.user_db, password=self.pass_db)) except Exception as e: print_exception("Could not connect to database:", e) else: self.uptime = datetime.datetime.utcnow() self.pool_pg = pool_pg print(f"Connected to the database ({time.time() - start})s") self.loop.run_until_complete(self.after_db()) self.run(self.token)
if ctx.author == self.bot.stella: return await ctx.reinvoke() await send_del(embed=BaseEmbed.to_error( title="Cooldown Error", description= f"You're on cooldown. Retry after `{error.retry_after:.2f}` seconds" )) elif isinstance(error, default_error): await send_del(embed=BaseEmbed.to_error(description=f"{error}")) else: if template := await self.generate_signature_error(ctx, error): await send_del(embed=template) else: await send_del(embed=BaseEmbed.to_error(description=f"{error}") ) traceback_error = print_exception( f'Ignoring exception in command {ctx.command}:', error) if not self.bot.tester: error_message = f"**Command:** {ctx.message.content}\n" \ f"**Message ID:** `{ctx.message.id}`\n" \ f"**Author:** `{ctx.author}`\n" \ f"**Guild:** `{ctx.guild}`\n" \ f"**Channel:** `{ctx.channel}`\n" \ f"**Jump:** [`jump`]({ctx.message.jump_url})```py\n" \ f"{traceback_error}\n" \ f"```" await self.bot.error_channel.send( embed=BaseEmbed.default(ctx, description=error_message) ) async def generate_signature_error(self, ctx, error): command = ctx.command