Detecting the double server boost
I am listening to the
messageCreate
event and, when the message.type
equals 8
, Sends a message to the channel. However, I want to avoid sending a message when a member boosts the server for the first time. because to handle this, I listen to the guildMemberUpdate
event to detect the automatic Nitro boost.
Essentially, I only want the messageCreate
event to trigger for a member's second boost onwards.
I would appreciate it if someone could guide me!
8 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!There is no reliably way to tell if its a second boost or not, since you also dont know when the boost is removed.
To implement this solution, I think this way good for it:
Create a
new Set
to track members who have been given the Nitro boost. Use the guildMemberUpdate
event to add the boosted member to the Set, and remove them after a few seconds. In the messageCreate
event, introduce a 1-second delay and check each message and ensure that the message type is equal to 8
and that the message.author
is not present in the Set.
What about it? Is there any better way?
Actually i don't need to know when boost removed!What if I want to boost with 2 hours in between?
Your way would already fail
Why not just track it solely through the messageCreate event and stop using the GMU altogether
Because it is public bot may someone doesn't activate the System Boost Message and i want detect the first time boost without any requirement
didnt you just say you want the second time boost?
Yes i want to
messageCreate
only for second time boost
But i found another solution:
Add member to the set in the guildMemberUpdate event and remove the member which is added to the set in messageCreate event like this in the first line:
For the second time cause the guildMemberUpdate
not trigger so the collection doesn't have a data about the member and condition will returns false