#View times outs even when I responded to it

1 messages · Page 1 of 1 (latest)

unreal carbon
#

This has never happened to me, but this view is timing out even when I respond to it by editing the message.

view class:

class SongSelectView(discord.ui.View):
    def __init__(self):
        super().__init__(timeout=60)

    async def on_timeout(self):
        await self.message.edit(content=f"{emotes.error} You took too long to select a song!", view=None, delete_after=20)```
#

In my callback I use interaction.response.edit_message and then I send a followup. The interaction was clearly responded cause if I attempt to change the followup to a interaction.response.send_message it raises the already responded error.

#

I am using 2.3.2

#

Still happens If i downgrade to 2.3.0

polar trail
unreal carbon
#

on_timeout executes even if i responded to the interaction

#

When it shouldn't

polar trail
#

when does the on_timeout trigger?

#

immediately after the response?

unreal carbon
#

After the set seconds

#

Which is 30

polar trail
unreal carbon
#

Initialization

polar trail
unreal carbon
#

That's the code. The select gets added manually

#

I can send it in a sec

polar trail
unreal carbon
#

Oh?

polar trail
#

that sounded weird out of context

unreal carbon
#

Should adding it on the init fix it?

#

Or

polar trail
unreal carbon
#

Thanks. Will try

#

@polar trail rooSob didnt work

#
def __init__(self, select):
        super().__init__(timeout=30)
        self.add_item(select)```
#
view = SongSelectView(SongSelect(
                        self.client, tracks[:5], ctx.author))```
solid bane
#

if you don't want on_timeout to trigger, you should run self.stop() in your callback

unreal carbon
#

Wth

polar trail
solid bane
unreal carbon
#

I see then

solid bane
#

though do note that this will, as implied, stop the view from functioning at all; if you don't want to stop the view, perhaps instead add another self variable which is edited in the callback, then you can check this in on_timeout

unreal carbon
#

You mean giving the select an attribute and then checking it on timeout?

#

Well, the attribute thing was a nice workaround. Thanks