matchy/py/matchy.py

39 lines
939 B
Python
Raw Normal View History

2024-08-09 22:28:02 +01:00
"""
matchy.py - Discord bot that matches people into groups
"""
2024-08-08 23:32:52 +01:00
import logging
2024-08-09 22:28:02 +01:00
import discord
from discord.ext import commands
import config
from state import load_from_file
2024-08-13 22:42:52 +01:00
from cogs.matchy_cog import MatchyCog
from cogs.owner_cog import OwnerCog
_STATE_FILE = "state.json"
state = load_from_file(_STATE_FILE)
2024-08-07 23:23:52 +01:00
2024-08-08 23:32:52 +01:00
logger = logging.getLogger("matchy")
logger.setLevel(logging.INFO)
2024-08-07 22:15:39 +01:00
intents = discord.Intents.default()
intents.message_content = True
2024-08-07 23:23:52 +01:00
intents.members = True
2024-08-09 22:12:58 +01:00
bot = commands.Bot(command_prefix='$',
description="Matchy matches matchees", intents=intents)
2024-08-07 22:15:39 +01:00
@bot.event
async def setup_hook():
await bot.add_cog(MatchyCog(bot, state))
await bot.add_cog(OwnerCog(bot, state))
@bot.event
async def on_ready():
logger.info("Logged in as %s", bot.user.name)
2024-08-07 23:23:52 +01:00
2024-08-09 22:12:58 +01:00
2024-08-09 23:14:42 +01:00
if __name__ == "__main__":
handler = logging.StreamHandler()
bot.run(config.Config.token, log_handler=handler, root_logger=True)