-
Hi, I've started to use this library recently and I'm a huge fan of it! I was wondering how I can wait for a button to be pressed before sending a followup response to an interaction, and if the button isn't pressed within a certain time period, it becomes disabled. I couldn't find any examples regarding this in the docs; any help would be appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Thanks for the kind words, I'm glad you find this useful! The easiest way to do what you mention is by using a followup to edit the original message, disabling the button. I just added an example of something similar: If the timeout is going to take a while and you'd rather not have a background thread for that whole time, you could instead try storing the timestamp of the original message inside the custom_id, then when a button press comes in, using the current time to determine if it's past the time limit. That wouldn't update the appearance of the button, though. Hope this helps, let me know if either approach works for you or feel free to reach out if you have any questions/issues! |
Beta Was this translation helpful? Give feedback.
Thanks for the kind words, I'm glad you find this useful!
The easiest way to do what you mention is by using a followup to edit the original message, disabling the button. I just added an example of something similar:
https://github.com/Breq16/flask-discord-interactions/blob/785ea3668e99faa13616f6a640a695ca6f8cd9ee/examples/followup.py#L97-L158
If the timeout is going to take a while and you'd rather not have a background thread for that whole time, you could instead try storing the timestamp of the original message inside the custom_id, then when a button press comes in, using the current time to determine if it's past the time limit. That wouldn't update the appearance of the button, th…