name = 'knb'
cur.execute('CREATE TABLE IF NOT EXISTS {}(userid INT, cost INT)'.format(name))
knb.commit()
@bot.command()
async def knb(ctx, user: discord.User = None):
name = 'knb'
if user is None:
await ctx.send(f"**{ctx.author}**, укажите пользователя, с которым желаете сыграть.")
else:
embed = discord.Embed(title='Вы начали игру "Камень Ножници Бумага".', description='Через 10 секунд появится победитель!', color=color)
await ctx.send(embed=embed)
embed1 = discord.Embed(title='Выберете', description='Камень Ножници Бумага', color=color)
await ctx.author.send(embed=embed1,
components = [
Select(
placeholder = "Select something!",
options = [
SelectOption(label = "Камень", value = "kamen"),
SelectOption(label = "Ножницы", value = "noj"),
SelectOption(label = "Бумага", value = "bum")
])])
interaction = await bot.wait_for("select_option")
if interaction.values[0] == 'kamen':
await interaction.send(content = "Вы выбрали камень")
cur.execute('INSERT INTO {} VALUES (?, ?)'.format(name), (ctx.author.id,1))
knb.commit()
elif interaction.values[0] == 'noj':
await interaction.send(content = "Вы выбрали ножницы")
cur.execute('INSERT INTO {} VALUES (?, ?)'.format(name), (ctx.author.id,2))
knb.commit()
elif interaction.values[0] == 'bum':
await interaction.send(content = "Вы выбрали бумагу")
cur.execute('INSERT INTO {} VALUES (?, ?)'.format(name), (ctx.author.id,3))
knb.commit()
await user.send(embed=embed1,
components = [
Select(
placeholder = "Select something!",
options = [
SelectOption(label = "Камень", value = "kamen"),
SelectOption(label = "Ножници", value = "noj"),
SelectOption(label = "Бумага", value = "bum")
])])
interaction = await bot.wait_for("select_option")
if interaction.values[0] == 'kamen':
await interaction.send(content = "Вы выбрали камень")
cur.execute('INSERT INTO {} VALUES (?, ?)'.format(name), (ctx.author.id,1))
knb.commit()
elif interaction.values[0] == 'noj':
await interaction.send(content = "Вы выбрали ножницы")
cur.execute('INSERT INTO {} VALUES (?, ?)'.format(name), (ctx.author.id,2))
knb.commit()
elif interaction.values[0] == 'bum':
await interaction.send(content = "Вы выбрали бумагу")
cur.execute('INSERT INTO {} VALUES (?, ?)'.format(name), (ctx.author.id,3))
knb.commit()