2018-07-30 03:48:58 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
# encoding: utf-8
|
|
|
|
|
2018-07-30 05:15:38 +00:00
|
|
|
import logging
|
2018-07-30 05:26:06 +00:00
|
|
|
import traceback
|
2018-07-30 05:15:38 +00:00
|
|
|
|
2018-07-30 03:48:58 +00:00
|
|
|
import discord
|
2019-08-30 21:46:35 +00:00
|
|
|
from ben_cogs.bot import BenCogsBot
|
2018-07-30 03:48:58 +00:00
|
|
|
from discord.ext import commands
|
|
|
|
|
2018-07-30 05:15:38 +00:00
|
|
|
logging.basicConfig(level=logging.WARNING)
|
2019-06-04 03:08:44 +00:00
|
|
|
logging.getLogger('discord').setLevel(logging.INFO)
|
2018-07-30 05:15:38 +00:00
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
logger.setLevel(logging.INFO)
|
|
|
|
|
2019-08-30 21:46:35 +00:00
|
|
|
class Bot(BenCogsBot):
|
|
|
|
startup_extensions = (
|
|
|
|
'cogs.emote',
|
|
|
|
'cogs.meta',
|
|
|
|
'ben_cogs.debug',
|
|
|
|
'ben_cogs.misc',
|
|
|
|
'ben_cogs.stats',
|
|
|
|
'jishaku',
|
|
|
|
)
|
|
|
|
|
2018-07-30 04:34:27 +00:00
|
|
|
def __init__(self, **kwargs):
|
|
|
|
with open('config.py') as f:
|
2019-08-30 21:46:35 +00:00
|
|
|
config = eval(f.read(), {})
|
2018-08-01 02:05:23 +00:00
|
|
|
|
2019-08-30 21:46:35 +00:00
|
|
|
super().__init__(config=config, **kwargs)
|
2018-08-22 15:27:35 +00:00
|
|
|
self._setup_success_emojis()
|
|
|
|
|
|
|
|
def _setup_success_emojis(self):
|
|
|
|
"""Load the emojis from the config to be used when a command fails or succeeds
|
|
|
|
We do it this way so that they can be used anywhere instead of requiring a bot instance.
|
|
|
|
"""
|
|
|
|
import utils.misc
|
|
|
|
default = ('❌', '✅')
|
|
|
|
utils.SUCCESS_EMOJIS = utils.misc.SUCCESS_EMOJIS = (
|
|
|
|
self.config.get('response_emojis', {}).get('success', default))
|
|
|
|
|
2019-08-30 21:46:35 +00:00
|
|
|
def initial_activity(self):
|
|
|
|
if not self.is_ready():
|
|
|
|
return super().activity
|
|
|
|
return super().activity or discord.Game(f'@{self.user.name} help')
|
2018-07-30 03:48:58 +00:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2019-08-30 21:46:35 +00:00
|
|
|
Bot().run()
|