can't read the mentions of a webhook

I have a minor issue. So to give vote rewards, I have a webhook from top.gg that logs everytime a user votes. I usually get the userID of the user through the webhook but I just noticed if someone who is not a member of my support server votes the bot, somehow the mention of the user in the webhook disappears although in the message it is there. I'm getting the user with this :- User = message.mentions.users.first()
14 Replies
d.js toolkit
d.js toolkit4mo 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! - Marked as resolved by staff
Syjalo
Syjalo4mo ago
Discord sends there only those who is actually pinged You can parse mentions with a regex to get the id MessageMentions.GlobalUsersPattern
Dante
DanteOP4mo ago
I'm getting the message through a messageCreate event, do I need to get a parameter from the callback called 'MessageMentions'?
Syjalo
Syjalo4mo ago
No, MessageMentions is a class and GlobalUsersPattern is its static property You import it from discord.js
Dante
DanteOP4mo ago
Can you like give me an example code? Assuming that message is the Message I get from the messageCreate event I get that this will give me a regex, but what do I use it on? The webhook's content and description is coming empty when I log it
Syjalo
Syjalo4mo ago
What do you mean empty?
Dante
DanteOP4mo ago
Like quite literally it's empty message.embeds Is an empty array and message.content doesn't log anything
Syjalo
Syjalo4mo ago
Are you getting it through the webhook or messageCreate event? If later you need MessageContent intent
Dante
DanteOP4mo ago
This is the webhook for reference. And I'm getting message that contains the webhook through the messageCreate event
No description
Dante
DanteOP4mo ago
I'm sorry if that's the wrong approach 💀 Can you tell me how I can do it in the correct way?
Syjalo
Syjalo4mo ago
If that's the bot mentioned it should be able to get the content But I think topgg give some kind of API for votes
Dante
DanteOP4mo ago
It doesn't unfortunately
Syjalo
Syjalo4mo ago
What do you need that for? I see there's a way to get last 1k votes or whether a user is voted or not https://docs.top.gg/docs/API/bot#last-1000-votes
Bots | Top.gg Documentation
API resource for a bots or apps on a platform like Discord
Dante
DanteOP4mo ago
Actually wait shit, is it because I don't have the message content intent enabled I basically wanted an automated system that doesn't need any action from the users, basically they vote and automatically get the rewards by triggering the webhook Ah dang this was the case all along!
Want results from more Discord servers?
Add your server