Unable to delete message from DM
Error [ChannelNotCached]: Could not find the channel where this message came from in the cache!
at Message.delete (C:\Users\muqia\Documents\Projects\HaroonBot\node_modules\discord.js\src\structures\Message.js:828:30)
at C:\Users\muqia\Documents\Projects\HaroonBot\dist\index.js:477:43
at Generator.next (<anonymous>)
at C:\Users\muqia\Documents\Projects\HaroonBot\dist\index.js:35:71
at new Promise (<anonymous>)
at __awaiter (C:\Users\muqia\Documents\Projects\HaroonBot\dist\index.js:31:12)
at Client.<anonymous> (C:\Users\muqia\Documents\Projects\HaroonBot\dist\index.js:70:57)
at Client.emit (node:events:514:28)
at InteractionCreateAction.handle (C:\Users\muqia\Documents\Projects\HaroonBot\node_modules\discord.js\src\client\actions\InteractionCreate.js:97:12)
at module.exports [as INTERACTION_CREATE] (C:\Users\muqia\Documents\Projects\HaroonBot\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36) {
code: 'ChannelNotCached'
}
Error [ChannelNotCached]: Could not find the channel where this message came from in the cache!
at Message.delete (C:\Users\muqia\Documents\Projects\HaroonBot\node_modules\discord.js\src\structures\Message.js:828:30)
at C:\Users\muqia\Documents\Projects\HaroonBot\dist\index.js:477:43
at Generator.next (<anonymous>)
at C:\Users\muqia\Documents\Projects\HaroonBot\dist\index.js:35:71
at new Promise (<anonymous>)
at __awaiter (C:\Users\muqia\Documents\Projects\HaroonBot\dist\index.js:31:12)
at Client.<anonymous> (C:\Users\muqia\Documents\Projects\HaroonBot\dist\index.js:70:57)
at Client.emit (node:events:514:28)
at InteractionCreateAction.handle (C:\Users\muqia\Documents\Projects\HaroonBot\node_modules\discord.js\src\client\actions\InteractionCreate.js:97:12)
at module.exports [as INTERACTION_CREATE] (C:\Users\muqia\Documents\Projects\HaroonBot\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36) {
code: 'ChannelNotCached'
}
3 Replies
else if(interaction.customId == 'reportRefer') {
const btn = interaction.message.components[0].components[1]
if(btn.type == ComponentType.Button) {
const embed = new InfoEmbed( ':exclamation_alert: Referral Report!',`
\n\n
:angle_jhm:Reported By:
:divider_jhm:User ID: ${interaction.user.id}
:divider_jhm:User Tag: ${interaction.user.tag}
Referred By:
\n
:angle_jhm: Post: ${btn.url}`).setColor(0xff0000);
(channels.reportLog as TextChannel).send({embeds: [embed]})
}
interaction.message.delete()
interaction.user.send({content: ':Staff: Thank you for your report, the staff team will investigate on this issue.'})
return
}
else if(interaction.customId == 'reportRefer') {
const btn = interaction.message.components[0].components[1]
if(btn.type == ComponentType.Button) {
const embed = new InfoEmbed( ':exclamation_alert: Referral Report!',`
\n\n
:angle_jhm:Reported By:
:divider_jhm:User ID: ${interaction.user.id}
:divider_jhm:User Tag: ${interaction.user.tag}
Referred By:
\n
:angle_jhm: Post: ${btn.url}`).setColor(0xff0000);
(channels.reportLog as TextChannel).send({embeds: [embed]})
}
interaction.message.delete()
interaction.user.send({content: ':Staff: Thank you for your report, the staff team will investigate on this issue.'})
return
}
- 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!