如何让我的不和谐机器人更新频道权限作为一项操作?

时间:2021-03-29 14:47:06

标签: javascript permissions discord discord.js bots

所以我在这里有这个简单的功能,我的机器人在 10 秒后向特定频道发送消息。我想以某种方式让我的机器人不仅发送消息,而且还自动编辑(SEND_MESSAGES)频道权限给@everyone

setTimeout(function() {
      client.channels.cache.get(`823225045231992892`).send('You cant send messages from now!')
    }, 10000);

1 个答案:

答案 0 :(得分:0)

Here 您可以获得有关如何更改权限的更多信息。

    setTimeout(() => {
      var channel = client.channels.cache.get(`823225045231992892`) 
      
        channel.send("You cant send messages from now!");
        channel.overwritePermissions(
          [
            {
              id: channel.guild.id,
              deny: ["SEND_MESSAGES"],
            },
          ],
          "Deny access to send messages"
        );
    }, 10000);