Example #1
0
File: server.py Project: elpeix/kaa
 def get_kaa(self, env, start_response) -> Kaa:
     kaa = Kaa(env, start_response)
     kaa.register_resources('example.resources', 'Resources')
     kaa.register_filter_request('example.filters', 'OnRequest')
     kaa.register_filter_response('example.filters', 'OnResponse')
     kaa.register_filter_response('example.filters', 'EnableCors')
     return kaa
Example #2
0
def main() -> None:
    load_dotenv()
    token = os.getenv('DISCORD_TOKEN')
    bot = Kaa()

    # required for dislash
    slash = SlashClient(bot)

    loop = asyncio.get_event_loop()
    loop.add_signal_handler(signal.SIGINT,
                            lambda s=signal.SIGINT: asyncio.create_task(
                                handle_sigint(s, loop, bot)))
    try:
        loop.run_until_complete(bot.start(token, bot=True, reconnect=True))
    except:
        loop.run_until_complete(bot.close())
    finally:
        loop.close()
Example #3
0
def setup(bot: Kaa) -> None:
    """function the bot uses to load this extension"""

    bot.add_cog(Math(bot))
Example #4
0
def setup(bot: Kaa) -> None:
    """function the bot uses to load this extension"""

    from ._cog import Python
    bot.add_cog(Python(bot))
Example #5
0
def setup(bot: Kaa) -> None:
    """function the bot uses to load this extension"""

    bot.add_cog(Documentation(bot))
Example #6
0
def setup(bot: Kaa) -> None:
    """function the bot uses to load this extension"""

    importlib.reload(_meme_generator)
    from ._cog import Memes
    bot.add_cog(Memes(bot))
Example #7
0
def setup(bot: Kaa) -> None:
    """function the bot uses to load this extension"""

    importlib.reload(kaa_help)
    bot.add_cog(Help(bot))
Example #8
0
def setup(bot: Kaa) -> None:
    """function the bot uses to load this extension"""

    bot.add_cog(CommandErrorHandler(bot))
Example #9
0
def setup(bot: Kaa) -> None:
    """function the bot uses to load this extension"""

    from ._cog import Games
    bot.add_cog(Games(bot))
Example #10
0
def setup(bot: Kaa) -> None:
    """function the bot uses to load this extension"""

    from ._cog import Code
    importlib.reload(_codeformatter)
    bot.add_cog(Code(bot))