I want to mention the user that sent the mand. I know my code style is weird, but I like the JavaScript like functions.
So this is what I've tried, it mentions the user using the arguments sent.
So for example, if you did !mention <user_id>
it would mention the user. I want to auto-detect this from the user sent.
function pingFunction(arguments, receivedMessage) {
if (arguments > 0) {
receivedMessage.channel.send("<@" + arguments + ">");
} else {
receivedMessage.channel.send("<@" + arguments + ">");
}
}
Thanks in advance!
I want to mention the user that sent the mand. I know my code style is weird, but I like the JavaScript like functions.
So this is what I've tried, it mentions the user using the arguments sent.
So for example, if you did !mention <user_id>
it would mention the user. I want to auto-detect this from the user sent.
function pingFunction(arguments, receivedMessage) {
if (arguments > 0) {
receivedMessage.channel.send("<@" + arguments + ">");
} else {
receivedMessage.channel.send("<@" + arguments + ">");
}
}
Thanks in advance!
Share Improve this question edited Dec 26, 2018 at 12:22 Federico Grandi 6,7865 gold badges33 silver badges51 bronze badges asked Dec 26, 2018 at 2:29 user10738016user107380161 Answer
Reset to default 1The way to get id of the person who sent the message is message.author.id
, or in your case, receivedMessage.author.id
.
From there, you can replace receivedMessage.channel.send("<@" + arguments + ">")
receivedMessage.channel.send("<@" + message.author.id + ">");
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744321403a4568432.html
评论列表(0条)