-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcommandes_slash.py
38 lines (31 loc) · 1.01 KB
/
commandes_slash.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import time
import discord
from discord.ext import commands
token = "VOTRE_TOKEN"
intents = discord.Intents.all()
bot = commands.Bot(command_prefix="!", intents=intents)
@bot.tree.command()
async def multiplication(interaction: discord.Interaction, a: int, b: int):
await interaction.response.send_message(f"{a} x {b} = {a * b}")
@bot.tree.command()
async def repete(interaction: discord.Interaction, nombre: int, message: str):
await interaction.response.send_message(message)
for _ in range(1, nombre):
await interaction.followup.send(message)
@bot.tree.command()
async def attends(interaction: discord.Interaction, secondes: int):
await interaction.response.defer()
time.sleep(secondes)
await interaction.followup.send("J'ai fini")
@bot.event
async def on_ready():
print(f"Connecté en tant que {bot.user}")
try:
synced = await bot.tree.sync()
print(f"{len(synced)} commande(s) synchronisée(s)")
except Exception as e:
print(e)
def main():
bot.run(token)
if __name__ == '__main__':
main()