【问题标题】:UnhandledPromiseRejectionWarning: TypeError [INVALID_TYPE]: Supplied roles is not an Role, Snowflake or ArUnhandledPromiseRejectionWarning: TypeError [INVALID_TYPE]: Supplied roles is not an Role, Snowflake or Ar
【发布时间】:2020-10-18 04:05:11
【问题描述】:

我目前正在尝试设置一个不和谐机器人,目前正在努力让它为成员提供角色。

代码如下:

client.on('message', (message) => {

if (message.content == '!pronouns she/her')
{
    message.member.roles.add(726463067331887124)
    message.channel.send(`Role added: she/her`);
}

(它对其他代词重复,但它本身总是相同的)

当我尝试在 discord 服务器上运行命令时,它在 Visual Studio Code 中给了我这个错误消息:

UnhandledPromiseRejectionWarning: TypeError [INVALID_TYPE]: Supplied roles is not an Role, Snowflake or Array or Collection of Roles or Snowflakes.

现在我有点卡住了

【问题讨论】:

    标签: visual-studio-code discord.js


    【解决方案1】:

    你错过了""

    message.member.roles.add("726463067331887124")
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-01-21
      • 2021-10-01
      • 2021-04-08
      • 2019-03-11
      • 2020-08-15
      • 2019-03-25
      • 1970-01-01
      • 2021-05-31
      相关资源
      最近更新 更多