【问题标题】:discord.js - TypeError [INVALID_TYPE]: Supplied parameter is not a User nor a Rolediscord.js - TypeError [INVALID_TYPE]:提供的参数不是用户也不是角色
【发布时间】:2021-11-15 10:18:18
【问题描述】:

如果我按下按钮,会出现以下错误:TypeError [INVALID_TYPE]: Supplied parameter is not a User nor a Role. 但是,我也可以在其中放置一个固定的 id,但仍然会出现此错误。

button.guild.channels.create('cs', {
            type: "text",
            parent_id: '802172599836213258',
            permissionOverwrites: [
               {
                 id: button.guild.roles.everyone,
                 deny: ['VIEW_CHANNEL', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY']
               },
               {
                id: button.clicker.id,
                allow: ['VIEW_CHANNEL', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY']
              }
            ]
          })

【问题讨论】:

    标签: javascript node.js discord discord.js bots


    【解决方案1】:

    我能看到的唯一可能的问题是button.guild.roles.everyonebutton.guild.roles 中没有所有人属性,所有人的 id 是公会 id,所以如果你用 button.guild.id 替换 button.guild.roles.everyone,它应该可以解决问题.

    button.guild.channels.create('cs', {
      type: "text",
      parent_id: '802172599836213258',
      permissionOverwrites: [
        {
          id: button.guild.id,
          deny: ['VIEW_CHANNEL', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY']
        },
        {
          id: button.clicker.id,
          allow: ['VIEW_CHANNEL', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY']
        }
      ]
    })
    

    【讨论】:

    • 还是不行。问题在于 ID,它的作用很好......
    • 尝试使用 button.user.id
    猜你喜欢
    • 1970-01-01
    • 2021-08-13
    • 2020-08-20
    • 2021-01-22
    • 1970-01-01
    • 2019-09-23
    • 2020-08-10
    • 2020-04-08
    • 2021-07-10
    相关资源
    最近更新 更多