问题描述
我是一个新的 JS/discord.js 开发人员,正在制作一个机器人,但 msg.mentions.users.first() 不起作用,此后没有任何运行。
代码 -
var mentioner = msg.mentions.users.first();
let mentiosner = msg.guild.members.cache.get(mentioner.id);
console.log(mentiosner.nickname)
let rand = Math.random(1,deaths.length)
let floor = Math.floor(rand * deaths.length)
console.log(deaths[floor])
console.log(rand)
let death = new discord.MessageEmbed
death.title = "**death'd**"
death.description = `${mentiosner.displayName} ${deaths[floor]}`
msg.channel.send(death)
解决方法
我不确定问题是什么,但也许这会对您有所帮助:
https://discordjs.guide/creating-your-bot/commands-with-user-input.html#mentions\
希望我能帮上忙;)
ShadowLp174