在使用类似于“us”的命令时,如何添加提及能力;费率@用户“;discord.js?
我正在尝试添加一个命令,可以在我的服务器中“funnyrate”成员。然而,当我使用该命令时,它只回复编写该命令的人,我如何使其“funnyrate@anotheruser”? 代码如下:在使用类似于“us”的命令时,如何添加提及能力;费率@用户“;discord.js?,discord,discord.js,Discord,Discord.js,我正在尝试添加一个命令,可以在我的服务器中“funnyrate”成员。然而,当我使用该命令时,它只回复编写该命令的人,我如何使其“funnyrate@anotheruser”? 代码如下: const Discord = require("discord.js"); module.exports.run = async (bot, message, args) => { var rating = Math.floor(Math.random() * 100)
const Discord = require("discord.js");
module.exports.run = async (bot, message, args) => {
var rating = Math.floor(Math.random() * 100) + 1;
message.reply(`you are ${rating}% funny`);
}
module.exports.help = {
name:"funnyrate"
}
使用消息#提及
和消息#频道#发送()
您正在尝试ping命令中提到的人吗?运行命令时,您希望发生什么?非常感谢!这起作用了
const Discord = require("discord.js");
module.exports.run = async (bot, message, args) => {
var rating = Math.floor(Math.random() * 100) + 1;
var mentionedMember = message.mentions.members.first();
if (!mentionedMember) return message.reply(`you are ${rating}% funny`);
return message.channel.send(`${mentionedMember}, you are ${rating}% funny`);
}
module.exports.help = {
name:"funnyrate"
}