preparation

This commit is contained in:
Tenzing Kandang 2026-03-10 17:06:28 +01:00
commit 90cd9bab71
2 changed files with 32 additions and 0 deletions

1
discord.py Submodule

@ -0,0 +1 @@
Subproject commit e55b308c1adb705a99bb0b30aa1d6dcc8ce05790

31
task_bot.py Normal file
View File

@ -0,0 +1,31 @@
import os
import discord
from discord.ext import commands
DISCORD_TOKEN = os.getenv('DISCORD_TOKEN')
intents = discord.Intents(messages=True, guilds=True)
intents.message_content = True
bot = commands.Bot(command_prefix='!', intents=intents)
@bot.tree.command(name='hello')
async def hello_command(interaction: discord.Interaction):
print(f"Received hello command from {interaction.user.display_name}") # Log intéraction
user_nick = interaction.user.display_name
await ctx.response.send_message(f'Hello {ctx.user.nick}!')
@bot.event
async def on_ready():
print(f'Logged in as {bot.user}')
await bot.tree.sync()
#Liste commandes registré
commands = await bot.tree.fetch_commands()
print("Registered Commands:")
for command in commands:
print(f"- {command.name}")
bot.run(DISCORD_TOKEN)