30 lines
700 B
Python
30 lines
700 B
Python
import discord
|
|
from discord.ext import commands
|
|
import os
|
|
from pathlib import Path
|
|
|
|
from database import init_db
|
|
from config import TOKEN, DB_TYPE, DB_URL
|
|
|
|
intents = discord.Intents.default()
|
|
intents.message_content = True
|
|
intents.guilds = True
|
|
intents.members = True
|
|
|
|
bot = commands.Bot(command_prefix="!", intents=intents)
|
|
|
|
@bot.event
|
|
async def on_ready():
|
|
await init_db()
|
|
|
|
# Load commands
|
|
commands_path = Path("commands")
|
|
for file in commands_path.glob("*.py"):
|
|
if file.stem != "__init__":
|
|
await bot.load_extension(f"commands.{file.stem}")
|
|
|
|
# await bot.tree.sync()
|
|
print(f"Bot ready as {bot.user}")
|
|
|
|
if __name__ == "__main__":
|
|
bot.run(TOKEN) |