aboutsummaryrefslogtreecommitdiff
path: root/bot.py
diff options
context:
space:
mode:
authorParker <contact@pkrm.dev>2025-04-02 18:52:00 -0500
committerParker <contact@pkrm.dev>2025-04-02 18:52:00 -0500
commitb5099937f84e2fb58b69d97b4b8fff17363fe7d9 (patch)
treece0626d12ad3daf9bf2b7c103914bf7411ea245e /bot.py
parentae1ac1d731813008682ccba70db0f228b15a72e3 (diff)
First commit. Lots of stuff
Diffstat (limited to 'bot.py')
-rw-r--r--bot.py43
1 files changed, 43 insertions, 0 deletions
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)