hitomi/bot/__init__.py
Brian S. Stephan 6a5985b002 add on_message_handlers to Bot, by extending Bot
Bot is now extended as Hitomi, so that we can add on_message_handlers =
[], which will store functions to call when on_message happens. this is
necessary because i want to have two things react to on_message, but the
discord.py code only supports one coroutine for on_message. so, this is
a hook into it to do what i want

not sure if i'll end up needing this for on_message_edit or
on_message_delete, but i'm skeptical right now
2018-01-09 15:16:01 -06:00

18 lines
547 B
Python

"""Discord bot Hitomi and its library functions."""
from discord.ext import commands
from django.conf import settings
BOT_DESCRIPTION = "A simple Discord bot."
class Hitomi(commands.Bot):
"""Extend the discord.py Bot, to add more cool stuff."""
def __init__(self, *args, **kwargs):
"""Initialize bot, and cool stuff."""
super(Hitomi, self).__init__(*args, **kwargs)
self.on_message_handlers = []
hitomi = Hitomi(command_prefix='!', description=BOT_DESCRIPTION, max_messages=settings.DISCORD_BOT_MAX_MESSAGES)