def setup(bot: Friendo) -> None: """Adding the help cog.""" if not settings.FRIENDO_API_USER: raise EnvironmentError( "Missing environment variable: FRIENDO_API_USER") if not settings.FRIENDO_API_PASS: raise EnvironmentError( "Missing environment variable: FRIENDO_API_PASS") bot.add_cog(DogeBoard(bot))
def setup(bot: Friendo) -> None: """Load the Utilities cog.""" bot.add_cog(Utilities(bot))
def setup(bot: Friendo) -> None: """Sets up the AdventOfCode cog.""" bot.add_cog(AdventOfCode(bot))
def setup(bot: Friendo) -> None: """Load the Memes cog.""" bot.add_cog(Memes(bot))
def setup(bot: Friendo) -> None: """Load the Todo_List cog.""" bot.add_cog(TodoList(bot))
def setup(bot: Friendo) -> None: """Load the User cog.""" bot.add_cog(User(bot))
def setup(bot: Friendo) -> None: """Load the Image Segmentation cog.""" bot.add_cog(Segmentation(bot))
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")
def setup(bot: Friendo) -> None: """Load the Fun cog.""" bot.add_cog(Fun(bot))
def setup(bot: Friendo) -> None: """Load the Admin cog.""" bot.add_cog(Administration(bot))
def setup(bot: Friendo) -> None: """Sets up the Pixelate cog.""" bot.add_cog(Pixelate(bot))
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)
def setup(bot: Friendo) -> None: """Load the CovidStats cog.""" bot.add_cog(CovidStats(bot))