How do i delete a followup to a deferreply using a button?

I currently have await interaction.deleteReply() in the button callback but it gives the error error: Uncaught (in promise) DiscordAPIError[10015]: Unknown Webhook.
7 Replies
d.js toolkit
d.js toolkit4d ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
NyR
NyR4d ago
deleteReply takes message parameter that you want to delete, if you showed your code, we might be able to help you better
jsw
jswOP4d ago
jsw
jswOP4d ago
i'm not sure how i'd get the message parameter in the button event handler this file returns
export interface SlashCommand {
command:
| SlashCommandBuilder
| SlashCommandOptionsOnlyBuilder
| SlashCommandSubcommandsOnlyBuilder;
execute: (interaction: ChatInputCommandInteraction) => void;
autocomplete?: (interaction: AutocompleteInteraction) => void;
modal?: (interaction: ModalSubmitInteraction<CacheType>) => void;
button?: (interaction: ButtonInteraction<CacheType>) => void;
inDm?: boolean;
inGuild?: boolean;
permissions?: Permissions;
}
export interface SlashCommand {
command:
| SlashCommandBuilder
| SlashCommandOptionsOnlyBuilder
| SlashCommandSubcommandsOnlyBuilder;
execute: (interaction: ChatInputCommandInteraction) => void;
autocomplete?: (interaction: AutocompleteInteraction) => void;
modal?: (interaction: ModalSubmitInteraction<CacheType>) => void;
button?: (interaction: ButtonInteraction<CacheType>) => void;
inDm?: boolean;
inGuild?: boolean;
permissions?: Permissions;
}
and those funcitons will be ran by the event handlers I'm trying to implement a delete button for the typst error messages
jsw
jswOP4d ago
GitHub
GitHub - jsw08/DCBot at 31-errors-delete-button-mainly-typst-ts
Jsw's slaafje. Contribute to jsw08/DCBot development by creating an account on GitHub.
NyR
NyR4d ago
Well you are trying to delete a reply to a interaction without acknowledging it first in your button handler, so reply doesn't exist yet. You can do something like this
await interaction.deferUpdate();
await interaction.deleteReply();
await interaction.deferUpdate();
await interaction.deleteReply();
jsw
jswOP4d ago
It works! Tysm
Want results from more Discord servers?
Add your server