basic setup
This commit is contained in:
commit
b3508664d3
9 files changed
+186
No files matched your search
@@ -0,0 +1,38 @@
|
||||
import os
|
||||
import asyncio
|
||||
import discord
|
||||
from discord.ext import commands
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
TOKEN = os.getenv('DISCORD_TOKEN')
|
||||
|
||||
intents = discord.Intents.default()
|
||||
intents.message_content = True
|
||||
|
||||
bot = commands.Bot(command_prefix="Warum Kann das nicht weg??? :C", intents=intents)
|
||||
|
||||
@bot.event
|
||||
async def on_ready():
|
||||
print(f'Logged in as {bot.user} (ID: {bot.user.id})')
|
||||
print('------')
|
||||
|
||||
try:
|
||||
synced = await bot.tree.sync()
|
||||
print(f"Synced {len(synced)} command(s) successfully!")
|
||||
except Exception as e:
|
||||
print(f"Failed to sync commands: {e}")
|
||||
|
||||
|
||||
async def load_extensions():
|
||||
for filename in os.listdir('./commands'):
|
||||
if filename.endswith('.py'):
|
||||
await bot.load_extension(f'commands.{filename[:-3]}')
|
||||
print(f'Loaded extension: commands.{filename[:-3]}')
|
||||
|
||||
async def main():
|
||||
async with bot:
|
||||
await load_extensions()
|
||||
await bot.start(TOKEN)
|
||||
|
||||
asyncio.run(main())
|
||||
Reference in new issue
Block a user