0

因此,我正在覆盖票证功能的权限,并给我一个错误

无法读取未定义的属性“通道”

使用这行代码:

    message.guild.channels.create(`create-${message.author.id}`, { type: 'text' }).then(c => {
    c.message.channel.overwritePermissions([
      {
        id: "@everyone",
        deny: ['SEND_MESSAGES', 'READ_MESSAGES'],
      }
    ]);
    c.message.channel.overwritePermissions([
      {
        id: message.author.id,
        allow: ['SEND_MESSAGES', 'READ_MESSAGES'],
      },
    ]);

它与第二行和第八行(AKA)有关

c.message.channel.overwritePermissions([

X2

如果我从此属性中删除消息

c.message.channel.overwritePermissions([

我收到这个错误

TypeError:无法读取未定义的属性“overwritePermissions”

4

1 回答 1

1

Channel没有message财产,也没有其他channel财产。


message.guild.channels.create(`create-${message.author.id}`, {
    type: 'text', permissionOverwrites: [
        {
            id: '@everyone',
            deny: ['SEND_MESSAGES', 'VIEW_CHANNEL']
        },
        {
            id: message.author.id,
            allow: ['SEND_MESSAGES', 'VIEW_CHANNEL']
        }
    ]
})

请注意,没有权限称为READ_MESSAGES. 相反,使用VIEW_CHANNEL.

于 2021-07-12T16:56:23.863 回答