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
d.js toolkit
d.js toolkit•16mo 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!
space
space•16mo ago
You probably need to await / collect those messages. Discord does not seem to return those message (ids).
skeddles
skeddlesOP•16mo ago
you mean listen for them separately?
space
space•16mo ago
However you want.
skeddles
skeddlesOP•16mo ago
how else could i do it than client.on('messageCreate',
space
space•16mo ago
Collectors: https://discordjs.guide/popular-topics/collectors.html#collectors (Which are an abstraction around your snippet above, just much less of a footgun)
skeddles
skeddlesOP•16mo ago
nice that seems to work (testing with adding reaction instead of deleting) thanks @sp🦄ce !!
skeddles
skeddlesOP•16mo ago
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
Want results from more Discord servers?
Add your server