You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
893 B
34 lines
893 B
2 years ago
|
#!/usr/bin/env python3
|
||
2 years ago
|
from discord.ext import commands
|
||
2 years ago
|
import hrochobot.utils.data as data
|
||
2 years ago
|
import logging
|
||
2 years ago
|
import os
|
||
2 years ago
|
|
||
2 years ago
|
data.DATA_FOLDER = os.environ.get("HROCHOBOT_DATA", 'data')
|
||
|
LOG_FOLDER = os.environ.get("HROCHOBOT_LOG", '.')
|
||
|
|
||
|
logger = logging.getLogger('hrochobot')
|
||
2 years ago
|
logger.setLevel(logging.INFO)
|
||
2 years ago
|
handler = logging.FileHandler(filename=f'{LOG_FOLDER}/hrochobot.log', encoding='utf-8', mode='w')
|
||
2 years ago
|
handler.setFormatter(logging.Formatter('%(asctime)s:%(levelname)s:%(name)s: %(message)s'))
|
||
|
logger.addHandler(handler)
|
||
2 years ago
|
|
||
|
CONFIG = data.load_json("config")
|
||
|
|
||
|
bot = commands.Bot()
|
||
|
|
||
|
cogs_list = [
|
||
|
'basic',
|
||
2 years ago
|
'roles',
|
||
2 years ago
|
'ksp',
|
||
2 years ago
|
]
|
||
|
|
||
|
for cog in cogs_list:
|
||
2 years ago
|
bot.load_extension(f'hrochobot.cogs.{cog}')
|
||
2 years ago
|
|
||
2 years ago
|
@bot.listen('on_interaction')
|
||
|
async def statistics(interaction):
|
||
|
logger.info(f"{interaction.user} ({interaction.user.id}) used command {interaction.data['name']}.")
|
||
|
|
||
2 years ago
|
bot.run(CONFIG["token"])
|