pycord get interaction without resending or editing message after restart
Question:
im currently working on a selfroles bot for my server and i got this problem everytim i restart the bot the message with the button to click has to be edited or resend to make the button work again or else it will just say "This interaction failed".
This is the code for my button:
embed = discord.Embed(
description="Title"
"Description"
)
requestbutton = discord.ui.Button(
label="make a request"
)
async def requestcallback(interaction: discord.Interaction):
modal = RequestModal()
await interaction.response.send_modal(modal)
requestbutton.callback = requestcallback
view = discord.ui.View()
view.timeout = None
view.add_item(requestbutton)
await requestschannel.send(embed=embed, view=view)
Is it possible to get the button to work again after a restart without resending or editing the message?
Answers:
I fixed it using PersistentViews.
Examples at:
https://github.com/Pycord-Development/pycord/blob/master/examples/views/persistent.py
im currently working on a selfroles bot for my server and i got this problem everytim i restart the bot the message with the button to click has to be edited or resend to make the button work again or else it will just say "This interaction failed".
This is the code for my button:
embed = discord.Embed(
description="Title"
"Description"
)
requestbutton = discord.ui.Button(
label="make a request"
)
async def requestcallback(interaction: discord.Interaction):
modal = RequestModal()
await interaction.response.send_modal(modal)
requestbutton.callback = requestcallback
view = discord.ui.View()
view.timeout = None
view.add_item(requestbutton)
await requestschannel.send(embed=embed, view=view)
Is it possible to get the button to work again after a restart without resending or editing the message?
I fixed it using PersistentViews.
Examples at:
https://github.com/Pycord-Development/pycord/blob/master/examples/views/persistent.py