31 lines
840 B
Python
31 lines
840 B
Python
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) |