60 lines
1.5 KiB
Python
60 lines
1.5 KiB
Python
import asyncio
|
|
import datetime
|
|
import logging
|
|
import os
|
|
|
|
import discord
|
|
from discord.ext import commands
|
|
|
|
date = f'{datetime.datetime.now().year}-{datetime.datetime.now().month}-{datetime.datetime.now().day}'
|
|
log_level = logging.INFO if os.environ.get('LOG_LEVEL') == 'INFO' else 'WARN'
|
|
logging.basicConfig(
|
|
filename=f'logs/discord/{date}.log',
|
|
format='%(asctime)s - majordomo - %(levelname)s - %(message)s',
|
|
level=log_level
|
|
)
|
|
|
|
COGS = [
|
|
'cogs.owner',
|
|
'cogs.players',
|
|
'cogs.transactions',
|
|
'cogs.admins',
|
|
'cogs.dice',
|
|
'cogs.fun',
|
|
'cogs.exception-handler'
|
|
# 'cogs.gameday',
|
|
# 'cogs.gameplay'
|
|
]
|
|
|
|
intents = discord.Intents.default()
|
|
intents.message_content = True
|
|
intents.members = True
|
|
bot = commands.Bot(
|
|
command_prefix='!',
|
|
intents=intents,
|
|
description='The Strat-o-matic Bot\nIf you have questions, feel free to contact Cal.',
|
|
case_insensitive=True,
|
|
owner_id=258104532423147520
|
|
)
|
|
|
|
|
|
@bot.event
|
|
async def on_ready():
|
|
logging.info('Logged in as:')
|
|
logging.info(bot.user.name)
|
|
logging.info(bot.user.id)
|
|
|
|
|
|
async def main():
|
|
for c in COGS:
|
|
try:
|
|
await bot.load_extension(c)
|
|
logging.info(f'Loaded cog: {c}')
|
|
except Exception as e:
|
|
logging.error(f'Failed to load cog: {c}')
|
|
logging.error(f'{e}')
|
|
async with bot:
|
|
await bot.start(os.environ.get('BOT_TOKEN'))
|
|
|
|
asyncio.run(main())
|