如何使用“ overwritePermissions”功能打开某个频道的权限?

时间:2019-08-05 17:32:56

标签: javascript discord.js

我希望能够输入“ $ unlock”并解锁某个频道的权限。我不知道如何将ID转换为文本频道ID。

switch (args[0]) {
        case "unlock":
        if(!message.member.roles.find(r => r.name === "Unlockable")) return message.channel.sendMessage('You do not have permission to use this command.')

          const textChannell = ('607370435553918977');
          if (!textChannell) {
            console.log('Please support a unlock channel ID.');
          }
        textChannell.overwritePermissions(message.author, { //I also want to change the everyone role, not just the author of the message

          SEND_MESSAGES: true,
          VIEW_CHANNEL: true
        })
          .then(updated => console.log(updated.permissionOverwrites.get(message.author.id)))
    break;
    }

我希望它更改textchannell的ID权限,但出现以下错误:

TypeError: textChannell.overwritePermissions is not a function

1 个答案:

答案 0 :(得分:0)

尝试将ID分配给类似这样的变量

const testChat = '607370435553918977';
client.channels.get(testChat).overwritePermissions