首页 > 解决方案 > 如何让我的不和谐机器人更新频道权限作为一项操作?

问题描述

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

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

标签: javascriptpermissionsdiscorddiscord.jsbots

解决方案


在这里,您可以获得有关如何更改权限的更多信息。

    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);

推荐阅读