I recently started converting my commands to slash commands. I successfully did that, but I'm missing one functionality that I can't seem to find how to do. I want to delete the response I've given to an interaction (so the callback), and if possible after a certain amount of time (but that isn't required for my Discord bot).
For example, my callback is posted like this:
client.api.interactions(interaction.id, interaction.token).callback.post({
data: {
type: 4,
data: {
content: 'Hello World!'
}
}
})
And I want to delete that response immediately (or timed, but not in this example).
In the Discord docs (this page) is standing that it is possible, but I don't know how exactly to do that.
The specific code I already tried is this, but when the code is executed I'm getting the METHOD NOT ALLOWED
error:
client.api.interactions(interaction.id, interaction.token).callback.delete()
I hope you can help me, thanks in advance.
Sorry for my bad English 😉
you can just fetch this : https://discordapp.com/api/webhooks/{APP ID}/{Interaction Token}/messages/@original
Like That :
fetch(
"https://discordapp.com/api/webhooks/123456789012345678/${interaction.token}/messages/@original"
, { method: "DELETE" } );
https://discord.com/developers/docs/interactions/slash-commands#delete-original-interaction-response