Deferring a command reply
Some commands that are ran could take longer time to respond. However, Discord only allows a maximum of 3 seconds for the bot to respond.
What is deferReply
?
deferReply
?deferReply
is a code that tells Discord API to allow you to delay responses. This feature allows the bot to have approximately 15 minutes to respond to Slash Commands, while Legacy Commands can respond at any time.
Why?
This helps to keep your command file short and clean without having to run interaction.deferReply()
then interaction.followUp()
or message.channel.sendTyping()
then message.reply()
every time.
Let's try adding this feature to our "Ping" command.
End Result:
Before bot replies:Slash Command
Last updated