Discord Python Button Press Triggers All Buttons In A Command
I am trying to create a bot for Discord in Python. However I am running into an issue with the newly added buttons. The issue is as follows: I use a command multiple times and this
Solution 1:
You can change the check function to:
defcheck(res):
return ctx.author == res.user and res.channel == ctx.channel and m == res.message
But you have to place it under this piece of code:
yes = Button(style=ButtonStyle.green, label="Yes")
no = Button(style=ButtonStyle.red, label="No")
m = await ctx.send(embed = em,components=[[no,yes]])
So the result should be:
yes = Button(style=ButtonStyle.green, label="Yes")
no = Button(style=ButtonStyle.red, label="No")
m = await ctx.send(embed = em,components=[[no,yes]])
defcheck(res):
return ctx.author == res.user and res.channel == ctx.channel and m == res.message
The new code checks if the embed message the bot sent is the responded message. I tested it, and it worked for me.
Post a Comment for "Discord Python Button Press Triggers All Buttons In A Command"