here's a mega simple coin flip example i made for this question is there any way to -edit the original slash command message with the result of the coin flip to get rid of the buttons -delete the original slash command message
class CoinFlipButtons(disnake.ui.View):
def __init__(self):
super().__init__(timeout=60)
@bot.slash_command(description="starts coin flip game")
async def coinflip(inter):
await inter.response.send_message("Coin has been flipped what shall you choose?", view=CoinFlipButtons())
@disnake.ui.button(label="Heads", style=ButtonStyle.green)
async def first_button(self, button: disnake.ui.Button, inter: disnake.MessageInteraction):
coin = random.randrange(1,2)
if coin == 1:
coin = "heads"
else:
coin = "tails"
if coin == "heads":
await inter.response.send_message(content=f"You were correct! It was {coin}")
else:
await inter.response.send_message(content=f"Oh no! The coin was {coin}")
@disnake.ui.button(label="Tails", style=ButtonStyle.red)
async def second_button(self, button: disnake.ui.Button, inter: disnake.MessageInteraction):
coin = random.randrange(1,2)
if coin == 1:
coin = "heads"
else:
coin = "tails"
if coin == "tails":
await inter.response.send_message(f"You were correct! It was {coin}")
else:
await inter.response.send_message(f"Oh no! The coin was {coin}")
I tried searching the docs for a edit original response message function or something of the sorts but those wouldn't work because interaction is redefined when i send the new response to the buttons and that's where im stumped because i wanna edit/delete the slash command interaction after the button interaction