When writing a command 2 times, even on different servers until the buttons disappear, when clicking on one of the "Remove warning" buttons, the bot responds 2 times instead of one, but at the same time only one warning is removed. Sometimes there is such an error: Command raised an exception: HTTPException: 400 Bad Request (error code: 40060): Interaction has already been acknowledged.
row - the number of warnings the user has
i - the maximum number of warns
How to fix it?
if i[0] == 0 or row[0] < i[0]:
message = await ctx.send(embed=emb,components=[disnake.ui.Button(label='Remove the warning', style=ButtonStyle.secondary)])
try:
responce = await client.wait_for('button_click', check=lambda message: message.author == ctx.author,timeout=60)
except asyncio.TimeoutError:
await ctx.edit_original_message(components=[])
return
if responce.component.label == 'Remove the warning':
await unwarnslash.unwarn_slash(ctx, member)
await ctx.edit_original_message(components=[])
await responce.response.defer()
elif row[0] >= i[0]:
await ctx.send(embed=emb)
await kickslash.kick_slash(ctx, member, 'Exceeded the number of warnings')