Give out XP when someone succesfully bumps server
Hi! So i want to give users XP when they bump the server.
I atm got this (ids hardcoreds to test, where msg id is an "Bump done! 👍"message):
Tho the
message.mentions.users
gives undefined.
How can i do this?6 Replies
DiscordJS version:
-- discord.js@14.22.1
NodeJS version: v22.18.0
tho using Bunmm.. maybe with this
with this you can check for command messages and get the user
Aside from your question, you're hitting the API too often with the current implementation. You can get rate-limited quickly. You're supposed to check the cache first before using
.fetch()
. Make sure you do that whenever possible.
Do this. Events give most of the necessary data you need at once, and populate the cache.just a couple notes
1. first directed to @Shizuka, most (I believe all, but not totally sure)
<Manager>.fetch(<id>)
calls check the cache first for you, so you don't actually need to do that yourself
2. on top of that I believe they only had those fetches for testing purposes and in production they would already be using the message from messageCreate
3. directed towards @HeapReaper, if it wasn't clear you'd likely want to do more than just check if a message is an application command response, so in case it's relevant, you may just be missing the MessageContent
intent
if you're seeing a mention, and you mean that message.mentions.users.first()
gives undefined
, this could be the reason
this would also be necessary to check <Message>.content
for the format of the message you're looking to detect
4. also instead of using a magic number and commenting // Application Command
after, you could always consider using the MessageType
enum (more specifically MessageType.ChatInputCommand
)That is good to know