From b5099937f84e2fb58b69d97b4b8fff17363fe7d9 Mon Sep 17 00:00:00 2001 From: Parker Date: Wed, 2 Apr 2025 18:52:00 -0500 Subject: First commit. Lots of stuff --- bot.py | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 bot.py (limited to 'bot.py') diff --git a/bot.py b/bot.py new file mode 100644 index 0000000..380ace3 --- /dev/null +++ b/bot.py @@ -0,0 +1,43 @@ +import discord +from discord.ext import commands +import os +from database import Base, engine + +import config as config +from src.utils.command_tree import Tree + + +class MyBot(commands.Bot): + def __init__(self): + super().__init__( + command_prefix="***", + activity=discord.Game(name="music!"), + intents=discord.Intents.default(), + tree_cls=Tree, + ) + + async def setup_hook(self): + for ext in os.listdir("./src/cogs"): + if ext.endswith(".py"): + await self.load_extension(f"src.cogs.{ext[:-3]}") + + for ext in os.listdir("./src/cogs/owner"): + if ext.endswith(".py"): + await self.load_extension(f"src.cogs.owner.{ext[:-3]}") + + async def on_ready(self): + Base.metadata.create_all(bind=engine) + config.LOG.info(f"{bot.user} has connected to Discord.") + config.LOG.info( + "Startup complete. Sync slash commands by DMing the bot" + f" {bot.command_prefix}tree sync (guild id)" + ) + + +bot = MyBot() +bot.remove_command("help") + + +if __name__ == "__main__": + config.load_config() + bot.run(config.TOKEN) -- cgit v1.2.3-70-g09d2