overwritePermissions 未定义

时间:2021-03-08 07:40:46

标签: discord discord.js

<块引用>

好的,所以我想制作一个锁定命令,以便通过一个命令没有人可以向该频道发送消息

我一直收到这个错误

TypeError: Cannot read property 'overwritePermissions' of undefined

  name: 'lockdown',
  aliases: [ 'lock', 'ld', 'lockchannel' ],
 
  run(client, message) 
  { message.channel.overwritePermissions([
    {
      id: message.guild.roles.everyone.id,
      deny: [ 'SEND_MESSAGES' ].slice(Number(
        !message.channel.permissionsFor(message.guild.roles.everyone)
        .has('SEND_MESSAGES'))),
      allow: [ 'SEND_MESSAGES' ].slice(Number(
        message.channel.permissionsFor(message.guild.roles.everyone)
        .has('SEND_MESSAGES')))
    },
    {
      id: message.guild.me.id,
      allow: [ 'SEND_MESSAGES' ]
    }
  ], `Mai Lockdown Command: ${message.author.tag}`)
  .then((ch) => message.channel.send(
    ch.permissionsFor(message.guild.roles.everyone).has('SEND_MESSAGES')
    ? '\\✔️ Lockdown Ended! Everyone can now send messages on this channel'
    : '\\✔️ Lockdown has initiated! Users withour special permissions will not be able to send messages here!'
  )).catch(() => message.channel.send(
    message.channel.permissionsFor(message.guild.roles.everyone).has('SEND_MESSAGES')
    ? '\\❌ Unable to Lockdown this channel!'
    : '\\❌ Unable to restore this channel!'
  ))
}
};```

0 个答案:

没有答案
相关问题