-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.py
More file actions
73 lines (59 loc) · 2.08 KB
/
Copy pathbot.py
File metadata and controls
73 lines (59 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import discord
from discord.ext import commands
import asyncio
import config
from database.db import Database
# ─────────────────────────────────────────
# Bot Setup
# ─────────────────────────────────────────
intents = discord.Intents.all()
bot = commands.Bot(
command_prefix=config.PREFIX,
intents=intents,
help_command=None,
case_insensitive=True
)
bot.db = Database()
# ─────────────────────────────────────────
# Load All Cogs
# ─────────────────────────────────────────
COGS = [
"cogs.events",
"cogs.slash_commands",
"cogs.automod",
"cogs.starboard",
"cogs.games",
]
async def main():
async with bot:
# Setup database
await bot.db.setup()
# Load cogs
for cog in COGS:
try:
await bot.load_extension(cog)
print(f" ✅ Loaded: {cog}")
except Exception as e:
print(f" ❌ Failed: {cog} — {e}")
# Sync slash commands
@bot.event
async def on_ready():
try:
synced = await bot.tree.sync()
print(f" ⚡ Synced {len(synced)} slash commands")
except Exception as e:
print(f" ❌ Sync failed: {e}")
# Start dashboard in background
async def start_dashboard():
try:
from dashboard.app import set_bot, app
set_bot(bot)
await app.run_task(host="0.0.0.0", port=config.DASHBOARD_PORT)
except Exception as e:
print(f" ⚠️ Dashboard failed: {e}")
bot.loop.create_task(start_dashboard())
# Start bot
print("\n🚀 Starting bot...")
await bot.start(config.TOKEN)
if __name__ == "__main__":
asyncio.run(main())