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; });

my error:
TypeError: Cannot read properties of undefined (reading 'messages')


the interaction it's on parameters of my module.exports
module.exports = async (client, interaction) => {
...
Was this page helpful?