From 90cd9bab711d2d1be6a54dfc6cd4d52e80db7fdf Mon Sep 17 00:00:00 2001 From: tenzi Date: Tue, 10 Mar 2026 17:06:28 +0100 Subject: [PATCH] preparation --- discord.py | 1 + task_bot.py | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 160000 discord.py create mode 100644 task_bot.py diff --git a/discord.py b/discord.py new file mode 160000 index 0000000..e55b308 --- /dev/null +++ b/discord.py @@ -0,0 +1 @@ +Subproject commit e55b308c1adb705a99bb0b30aa1d6dcc8ce05790 diff --git a/task_bot.py b/task_bot.py new file mode 100644 index 0000000..fd7229a --- /dev/null +++ b/task_bot.py @@ -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) \ No newline at end of file