#interaction.edit_original_message is so slow the interaction times out, causing a 404

1 messages · Page 1 of 1 (latest)

frank rivet
#

Can someone help me? The await interaction.response.edit_original_message() call is taking so long to actually do anything that the interaction "fails" and returns a 404 mid-call

see attached video

#
    @button(label="Turn ticket creation on", emoji="\N{ticket}")
    async def toggle_ticket_creation(self, _, interaction: discord.Interaction):
        self.modify_button(2)
        await interaction.edit_original_message(view=self)
        old = self.config.supportEnabled
        await self.config.update(supportEnabled=not self.config.supportEnabled)
        if old:
            return await interaction.response.send_message("Ticket creation has been turned off.", ephemeral=True)
        else:
            return await interaction.response.send_message("Ticket creation has been turned on.", ephemeral=True)

This is the button code
self.modify_button(2) just replaces on with off and vice versa in the button label, so it's not blocking the event loop or anything

frank rivet
dim drift
#

uhh no?

wheat mural
#

so are you trying to edit the slash command response?

frank rivet
#

oh ok I thought it did

frank rivet
frank rivet
dim drift
#

yeah, you can defer it and then send the message

#

because you are getting a the application did not respond?

frank rivet
#

I need it to update the original view

#

literally just changing a button

#

wow thanks peek good recording

#

I suppose I could fetch the original message before deferring then doing message.edit(...)

#

wait I have the context in the view I can just do ctx.edit can't I

dim drift
#

yeah

frank rivet
#

that worked

#

interactions are so fucky 😔

dim drift
#

discord should make libraries for us

frank rivet
#

In a perfect world

dim drift
#

and the libraries should accessible for all.