【问题标题】:How to make my discord bot update channel permissions as an action?如何让我的不和谐机器人更新频道权限作为一项操作?
【发布时间】:2021-06-25 14:38:00
【问题描述】:

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

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

【问题讨论】:

    标签: javascript permissions discord discord.js bots


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2020-12-28
      • 2020-10-15
      • 2023-04-05
      • 2019-06-24
      • 1970-01-01
      • 2020-05-07
      • 2020-11-14
      • 2020-09-06
      • 2021-06-09
      相关资源
      最近更新 更多