예제 #1
0
            else:
                args.append(arg)

        if command in bot.registry:
            bot.execute(command, *args, **kwargs)

        return ('', 200)

# @bot.command(name='cat', description='asdf')
# def cat():
#     r = requests.get('http://random.cat/meow')
#     if r.status_code == 200:
#         cat = r.json()['file']
#         bot.send_message(cat)

extensions = [
    'commands.cat',
    'commands.dice',
    'commands.gnomechild',
    'commands.kappa',
    'commands.eightball',
    'commands.count',
    'commands.tic'
]
for ext in extensions:
    bot.load_extension(ext)

if __name__ == '__main__':
    app.debug = True
    app.run(host='0.0.0.0')
예제 #2
0
"""Main bot module."""
import logging

from core.bot import Bot
from settings import settings
from settings.settings import DEBUG

instance = Bot()
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.DEBUG if DEBUG else logging.INFO)


# Register on ready event.
@instance.event
async def on_ready() -> None:
    """Notify that bot is ready."""
    logger.info('Bot is now running.')


# Load bot extensions.
instance.load_extension('extensions.owner')
instance.load_extension('extensions.publicroles')
instance.load_extension('extensions.mod')
instance.load_extension('extensions.autorole')
instance.load_extension('extensions.welcome')

# Run the bot.
instance.run(settings.DISCORD_TOKEN, bot=True, reconnect=True)