首页 > 解决方案 > discord.js var 令牌意外

问题描述

所以我得到了这段代码,我已经想弄清楚几个小时了,无论我尝试什么,我都无法弄清楚我的 var 有什么问题,什么也没有

async run (message, user) 
   var = mentionlycan = message.mentions.users.first()

   var lycanroll = Math.floor(Math.random() * 100) + 1;
    if (lycanroll < 50)
    guildMember.addRole(role, mentionlycan);

    message.reply(` ${mention} was attacked and converted into a Lycan`)

guildMember.addRole(role);
     if (lycanroll > 50)
     message.reply(`was attacked and they survived. ${mention}.`)





标签: javascriptbotsdiscord.js

解决方案


问题在第二行。

 var = mentionlycan = message.mentions.users.first()

你定义了一个错误的变量。将其更改为:

var mentionlycan = message.mentions.users.first();

推荐阅读