cool example in files cogs/coins.py

This commit is contained in:
Alex D
2023-04-23 19:20:35 +03:00
parent 98edc16962
commit c96d3cc636
+5 -5
View File
@@ -1,6 +1,6 @@
import asyncio import asyncio
import random import random
import disnake
from disnake.ext import commands from disnake.ext import commands
@@ -8,14 +8,14 @@ class Coins(commands.Cog):
def __init__(self, bot): def __init__(self, bot):
self.bot = bot self.bot = bot
@commands.slash_command(name="супер", description='Команда, которая возвращает орла или решку.') @commands.slash_command(name="монетка", description='Команда, которая возвращает орла или решку.')
async def coins(self, ctx): async def coins(self, ctx: disnake.ApplicationCommandInteraction):
coin = ["Орел", "Решка"] coin = ["Орел", "Решка"]
result = random.choice(coin) result = random.choice(coin)
info = await ctx.send(f"Орел или решка? Угадайте! Результат будет через 3 секунды...") await ctx.send(f"Орел или решка? Угадайте! Результат будет через 3 секунды...")
await asyncio.sleep(3) await asyncio.sleep(3)
await ctx.send(f"Результат: {result}!") await ctx.edit_original_response(f"Результат: {result}!")
def setup(bot): def setup(bot):