The simplest way to add the number of words in the sent message as points to the user?
I'm trying to do something. When a new message is sent, add the number of words in the message as points to the message owner.
But if the message is edited after it is sent, I need to find the word difference between the edited messages and add/subtract points. Here the following situation arises, if the bot is restarted after the message is sent, when the message is edited, the bot does not receive the event that the message has been edited.
The same goes for deleting a message. When a message is deleted, it needs to be saved in the cache to read its content (or in the database, but adding all messages to the database takes too much space)
What should I do in this situation? What method should I follow?
3 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!the code I use to add points
to delete points when a message is deleted
and to update the points earned when the message is edited
you seem to already be fully aware of all the moving parts to this issue
there aren't really any further methods to suggest
you can receive the events for the messages being edited/deleted for uncached messages by adding the
Message
partial, but discord doesn't send the old data, so these partial objects wouldn't really be useful
so only working with cached messages and saving the messages yourself are your best options
it's not really up to us to decide how your bot should behave, nor is this the place to just ask for advice on behavior/logic