ボタンを使ってみる
code:py
class Button(discord.ui.View):
def __init__(self):
super().__init__()
self.value = None
@discord.ui.button(label='ボタン', style=discord.ButtonStyle.green)
async def confirm(self, interaction: discord.Interaction, button: discord.ui.Button):
await interaction.response.send_message('ボタンが押されました', ephemeral=True)
self.value = True
self.stop()
@client.event
async def on_message(message):
if message.content == "!button":
await message.channel.send(view=Button())
https://gyazo.com/a72ee99049e1dac8ff0c94e99323f332