delete bot messages
is there an easy way to delete messages created by my bot like this? I tried setting to a variable the result of the
members.add()
and message.pin()
functions, but they return the member id and target message, not a message link to the new message sent in chat.9 Replies
- 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!You probably need to await / collect those messages.
Discord does not seem to return those message (ids).
you mean listen for them separately?
However you want.
how else could i do it than
client.on('messageCreate',
Collectors: https://discordjs.guide/popular-topics/collectors.html#collectors
(Which are an abstraction around your snippet above, just much less of a footgun)
nice that seems to work (testing with adding reaction instead of deleting)
thanks @sp🦄ce !!
ah crap, when i try to actually delete them it tells me
Cannot execute action on a system message
and from responses to others getting that message in this server, it sounds like it's just impossible to delete those messages
ah it seems it's just the join messages that are a problem, which i can avoid by just pinging them instead