43 lines
1.1 KiB
Python
43 lines
1.1 KiB
Python
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="***",
|
|
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)
|