preparation
This commit is contained in:
commit
90cd9bab71
1
discord.py
Submodule
1
discord.py
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit e55b308c1adb705a99bb0b30aa1d6dcc8ce05790
|
||||||
31
task_bot.py
Normal file
31
task_bot.py
Normal 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)
|
||||||
Loading…
x
Reference in New Issue
Block a user