After sending a message using interaction in discord.py, I’m attempting to use buttons to edit it. Editing is possible roughly up to 30 minutes after sending the message, but after that, I encounter the error ‘discord.errors.HTTPException: 401 Unauthorized (error code: 50027): Invalid Webhook Token’ and cannot edit the message. How can I continue to edit the message after this point?
async def editmsg(msg,con):
await msg.edit(content=con)
@app_commands.command(name='sendmsg', description='sendmsg')
async def sendmsg(self, interaction: Interaction):
await interaction.response.send_message(content='message')
msg = await interaction.original_response()
# The following code assumes that it is executed when a button is clicked.
await editmsg(msg,'editmessage')