delete message on ready event

i tried to exclude a message in event.js but that just doesn't work
interaction.channel.messages.fetch(messageid)
.then(message => { message.delete() })
.catch(() => { return; });
interaction.channel.messages.fetch(messageid)
.then(message => { message.delete() })
.catch(() => { return; });
my error:
TypeError: Cannot read properties of undefined (reading 'messages')
TypeError: Cannot read properties of undefined (reading 'messages')
the interaction it's on parameters of my module.exports
module.exports = async (client, interaction) => {
...
module.exports = async (client, interaction) => {
...
4 Replies
d.js toolkit
d.js toolkit2mo 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
Thiago
Thiago2mo ago
so my question is: i can fetch a message without fetch the channel first?
-Carlos👑
-Carlos👑2mo ago
not possible
Thiago
Thiago2mo ago
i get it thx