Answer the question
In order to leave comments, you need to log in
How to find out the second mentioned user in a message?
How can I find out the second mentioned user?
For example, the user enters the conditional command "/example @1#1111 @2#2222" and I need to extract "@2#2222" from this command so that, let's say, the bot sends the following: "The first user mentioned is @1#1111, second: @2#2222".
Answer the question
In order to leave comments, you need to log in
const prefix = "|"; // ваш префикс
const args = message.content.slice(prefix.length).trim().split(/ +/).slice(1);
if (message.content.startsWith(prefix + "mentions")) { // |mentions @first#1234 @second#4321
message.channel.send(`Первый упомянутый пользователь: ${args[0]}, второй: ${args[1]}`) // Первый упомянутый пользователь: @first#1234, второй: @second#4321
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question