diff options
author | Parker <contact@pkrm.dev> | 2025-04-02 18:52:00 -0500 |
---|---|---|
committer | Parker <contact@pkrm.dev> | 2025-04-02 18:52:00 -0500 |
commit | b5099937f84e2fb58b69d97b4b8fff17363fe7d9 (patch) | |
tree | ce0626d12ad3daf9bf2b7c103914bf7411ea245e /bot.py | |
parent | ae1ac1d731813008682ccba70db0f228b15a72e3 (diff) |
First commit. Lots of stuff
Diffstat (limited to 'bot.py')
-rw-r--r-- | bot.py | 43 |
1 files changed, 43 insertions, 0 deletions
@@ -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) |