微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

msg.mentions.users.first(),不运行

如何解决msg.mentions.users.first(),不运行

我是一个新的 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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。