2017-12-02 01:04:35 +00:00
|
|
|
import logging
|
|
|
|
import time
|
|
|
|
|
|
|
|
import discord
|
|
|
|
from discord.ext import commands
|
|
|
|
|
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
exts = [
|
|
|
|
'basic',
|
2017-12-02 15:53:47 +00:00
|
|
|
'admin',
|
|
|
|
'rsudo'
|
2017-12-02 01:04:35 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
class SexDungeonMistressBot(commands.Bot):
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
super().__init__(*args, **kwargs)
|
|
|
|
self.init_time = time.monotonic()
|
|
|
|
|
|
|
|
async def on_command(self, ctx):
|
|
|
|
# thanks dogbot ur a good
|
|
|
|
content = ctx.message.content
|
|
|
|
|
|
|
|
author = ctx.message.author
|
|
|
|
guild = ctx.guild
|
|
|
|
checks = [c.__qualname__.split('.')[0] for c in ctx.command.checks]
|
|
|
|
location = '[DM]' if isinstance(ctx.channel, discord.DMChannel) else \
|
|
|
|
f'[Guild {guild.name} {guild.id}]'
|
|
|
|
|
|
|
|
log.info('%s [cmd] %s(%d) "%s" checks=%s', location, author,
|
|
|
|
author.id, content, ','.join(checks) or '(none)')
|
|
|
|
|
|
|
|
|
|
|
|
def schedule_bot(loop, config, db):
|
|
|
|
mute = ['discord', 'websockets']
|
|
|
|
|
|
|
|
for l in mute:
|
|
|
|
d = logging.getLogger(l)
|
|
|
|
d.setLevel(logging.INFO)
|
|
|
|
|
|
|
|
bot = SexDungeonMistressBot(
|
|
|
|
command_prefix='sex ',
|
|
|
|
description='sexhouse management bot',
|
|
|
|
owner_id=getattr(config, 'owner_id', None),
|
|
|
|
)
|
|
|
|
|
|
|
|
bot.db = db
|
2017-12-02 15:53:47 +00:00
|
|
|
bot.config = config
|
2017-12-02 01:04:35 +00:00
|
|
|
|
|
|
|
try:
|
|
|
|
for ext in exts:
|
|
|
|
bot.load_extension(f'bot.ext.{ext}')
|
|
|
|
log.info('loaded %s', ext)
|
|
|
|
|
2017-12-02 15:53:47 +00:00
|
|
|
return bot
|
2017-12-02 01:04:35 +00:00
|
|
|
except:
|
|
|
|
log.exception('failed to load %s', ext)
|