Overview
As the bot gets more complicated and execution time increases, it is likely that we will begin to run into problem's with discord's hard 3-second limit on interaction responses before it will communicate that the interaction failed. This can lead to interesting bugs but will be especially alarming to students/TAs because it will indicate that something went wrong when it actually didn't.
Proposed solution
Anywhere in the code where we use interaction.response.send_message() should be replaced with interaction.followup.send(), and the very first thing in the logical flow of that button, modal submission, slash command, etc. should be interaction.response.defer(). you can have the bot appear as though it is thinking by using thinking=True as an argument. If you plan to make the response message ephemeral, you can indicate that too.
Overview
As the bot gets more complicated and execution time increases, it is likely that we will begin to run into problem's with discord's hard 3-second limit on interaction responses before it will communicate that the interaction failed. This can lead to interesting bugs but will be especially alarming to students/TAs because it will indicate that something went wrong when it actually didn't.
Proposed solution
Anywhere in the code where we use
interaction.response.send_message()should be replaced withinteraction.followup.send(), and the very first thing in the logical flow of that button, modal submission, slash command, etc. should beinteraction.response.defer(). you can have the bot appear as though it is thinking by usingthinking=Trueas an argument. If you plan to make the response message ephemeral, you can indicate that too.