-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.py
More file actions
38 lines (29 loc) · 957 Bytes
/
app.py
File metadata and controls
38 lines (29 loc) · 957 Bytes
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
import discord
from discord.ext import commands
import os
import asyncio
# Create the bot instance
intents = discord.Intents.all()
bot = commands.Bot(command_prefix="!", intents=intents)
@bot.event
async def on_ready():
print(f"Logged in as {bot.user}")
print("Bot is ready!")
# Function to load all extensions (no cogs folder)
async def load_extensions():
for filename in os.listdir("."):
if filename.endswith(".py") and filename != "app.py":
try:
await bot.load_extension(filename[:-3])
print(f"Loaded module: {filename}")
except Exception as e:
print(f"Failed to load {filename}: {e}")
async def main():
async with bot:
await load_extensions()
# Read token from token.txt
with open("token.txt", "r") as f:
token = f.read().strip()
await bot.start(token)
if __name__ == "__main__":
asyncio.run(main())