from discord import Intents from . import settings from bot.bot import Friendo if __name__ == "__main__": bot = Friendo(command_prefix=settings.COMMAND_PREFIX, help_command=None, intents=Intents.all()) # load help command bot.load_extension("bot.cogs.help") # load in basic commands bot.load_extension("bot.cogs.greetings") bot.load_extension("bot.cogs.utilities") bot.load_extension("bot.cogs.source") # load in image segmentation commands bot.load_extension("bot.cogs.image_segmentation") # load in Meme commands bot.load_extension("bot.cogs.memes") # load in Admin commands bot.load_extension("bot.cogs.admin") # load in Fun commands bot.load_extension("bot.cogs.fun") # load in randomcase command bot.load_extension("bot.cogs.randomcase")
Return an iterator going through each cog. On each iteration the cog is check for having a setup function raising a more readable error if not found. """ def on_error(name: str) -> NoReturn: raise ImportError(name=name) for module in pkgutil.walk_packages(cogs.__path__, f"{cogs.__name__}.", onerror=on_error): if module.ispkg: _import = __import__(module.name) if not inspect.isfunction(getattr(_import, "setup", None)): continue yield module.name if __name__ == "__main__": bot = Friendo( command_prefix=settings.COMMAND_PREFIX, help_command=None, intents=Intents.all(), allowed_mentions=AllowedMentions(everyone=False), ) for cog in _get_cogs(): bot.load_extension(cog) bot.run(settings.TOKEN)