Files
ai-homework-bot
cogs
utils
bot.py
config.json
requirements.txt
Code
18 1,122
bot.py
import discord
from discord.ext import commands
import os
from dotenv import load_dotenv
import json
load_dotenv()
with open("config.json", "r") as f:
config = json.load(f)
intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(
command_prefix="!",
intents=intents,
activity=discord.Game(name=config.get("activity_message", "tracking homework | /help")),
)
@bot.event
async def on_ready():
print(f"✅ {bot.user} is online and ready!")
try:
synced = await bot.tree.sync()
print(f"✅ Synced {len(synced)} slash command(s)")
except Exception as e:
print(f"❌ Failed to sync commands: {e}")
async def load_cogs():
await bot.load_extension("cogs.homework")
@bot.event
async def setup_hook():
await load_cogs()
TOKEN = os.getenv("DISCORD_TOKEN")
if not TOKEN:
raise ValueError("❌ DISCORD_TOKEN not found in .env file")
bot.run(TOKEN)