Untitled
unknown
plain_text
2 months ago
5.6 kB
6
Indexable
import discord
from discord.ext import commands
import asyncio
import os
# ─────────────────────────────────────────────
# TOKEN
# ─────────────────────────────────────────────
TOKEN = "your-token-here"
# ─────────────────────────────────────────────
# BOT SETUP
# ─────────────────────────────────────────────
intents = discord.Intents.default()
intents.message_content = True
intents.members = True
bot = commands.Bot(
command_prefix="z!",
intents=intents,
help_command=commands.DefaultHelpCommand(),
)
# ─────────────────────────────────────────────
# EVENTS
# ─────────────────────────────────────────────
@bot.event
async def on_ready():
print(f"✅ Logged in as {bot.user} ({bot.user.id})")
print(" Prefix : z!")
print(" Cogs : Auto-loaded from /cogs")
await bot.change_presence(
activity=discord.Activity(
type=discord.ActivityType.watching,
name="the gates open | z!help",
)
)
@bot.event
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandNotFound):
return
if isinstance(error, commands.MissingRequiredArgument):
await ctx.send(embed=discord.Embed(
description=f"⚠️ Missing argument. Use `z!help {ctx.command}`",
color=0xFF4444,
))
return
raise error
# ─────────────────────────────────────────────
# LOAD ALL COGS
# ─────────────────────────────────────────────
async def load_cogs():
for file in os.listdir("./cogs"):
if file.endswith(".py"):
try:
await bot.load_extension(f"cogs.{file[:-3]}")
print(f"✅ Loaded cog: {file}")
except Exception as e:
print(f"❌ Failed to load {file}: {e}")
# ─────────────────────────────────────────────
# MAIN
# ─────────────────────────────────────────────
async def main():
async with bot:
await load_cogs()
await bot.start(TOKEN)
if __name__ == "__main__":
asyncio.run(main())
))
)
)
)Editor is loading...
Leave a Comment