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

我希望能够输入“$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


元芳怎么了
浏览 151回答 1
1回答

慕妹3242003

尝试将 id 分配给这样的变量const testChat = '607370435553918977';client.channels.get(testChat).overwritePermissions
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript