Дискорд бот на Disnake. Как сделать кнопку неактивной, после нажатия?
Пишу бота дискорд на Disnake. Как правильно будет добавить disabled в код, чтобы кнопки были неактивными, после нажатия на них?
@bot.slash_command()
async def buttons(inter: disnake.ApplicationCommandInteraction):
await inter.response.send_message(
embed = disnake.Embed( title="Заголовок", description="Описание", color=0x992d22),
components=[
disnake.ui.Button(label="Кнопка1", style=disnake.ButtonStyle.secondary, custom_id="button1"),
disnake.ui.Button(label="Кнопка2", style=disnake.ButtonStyle.secondary, custom_id="button2"),
disnake.ui.Button(label="Кнопка3", style=disnake.ButtonStyle.secondary, custom_id="button3"),
],
)
@bot.listen("on_button_click")
async def help_listener(inter: disnake.MessageInteraction):
if inter.component.custom_id == "button1":
embed = disnake.Embed(title="Заголовок Кнопки1", description="Описание Кнопки1", color=0x992d22)
await inter.response.edit_message(embed=embed)
elif inter.component.custom_id == "button2":
embed = disnake.Embed(title="Заголовок Кнопки2", description="Описание Кнопки2", color=0x992d22)
await inter.response.edit_message(embed=embed)
elif inter.component.custom_id == "button3":
embed = disnake.Embed(title="Заголовок Кнопки3", description="Описание Кнопки3", color=0x992d22)
await inter.response.edit_message(embed=embed)
Источник: Stack Overflow на русском