Get multiple user
i want to do is only users that got pinged in that content can use the cmd otherwise you cant use it
25 Replies
• What's your exact discord.js
npm list discord.js
and node node -v
version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.what do you mean
“content”
**:sparkles:Shiny Hunt Pings:**
i want to make a autolock channel when there have sh hunter in poketwoI still don’t understand what you mean
you aren’t mentioning anyone in that
you can get all the pinged user id and save it in an array.
and when someone is tyring to interact with the cmd, you can make the bot accepts inputs only from the ids that you collected and placed in the array
can you give me some codes example?
I'm not on my PC rn, but I can try to describe it.
So first, use message.trim().split(/ /g) to turn received messages into array.
Then you can use a loop/for and search each of the array and find every array index that has "<@" in it. Make sure to .slice(2) and .slice(-1) to get the user id only
And then, filter out interaction from all user.
Just do something like
if (interaction.userID != [check each of the user id])
{ (either do return; or tell the user it's not for them, and then return;)}
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Seeing this, I should make a bot to make my server helping and guiding much easier :D
Or if you're an expert in the shortcuts and not a slow poke who need to understand how the process works, you can do that too
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
(I'm roasting myself btw*)
Good luck!
not understand at the loop/for part
alr so basically, you can get the mentions from what gwapes uwu said.
and then for the loop part, its not quite like a loop. but the general idea is to check if the user id that replied matches any of the saved ids.
Here's what i do to ignote imput from a set of channel (through their id):
maybe by implementing the same method (and use mentions instead of channel ID), you can do the same
mhm
also. it might be hard to see things, but I use different capitalizations for my channel variables and constant
in colored version
ignore the console log-
do you mean this?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
so use message.mentions.user() ?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Basically, just use message.mention.user.size to check how many mention is available in a message
const mentionSize = message.mention.user.size;
if (mentionSize < 1) return;
//process the mention ids here
@crow1000Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
oh. thx for telling me