如何让我的 discord bot 更新频道权限作为一个动作?
How to make my discord bot update channel permissions as an action?
所以我在这里有这个简单的功能,我的机器人在 10 秒后向特定频道发送消息。我想以某种方式让我的机器人不仅发送消息,而且自动编辑 (SEND_MESSAGES) 频道权限给@everyone
setTimeout(function() {
client.channels.cache.get(`823225045231992892`).send('You cant send messages from now!')
}, 10000);
您可以获得有关如何更改权限的更多信息。
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);
所以我在这里有这个简单的功能,我的机器人在 10 秒后向特定频道发送消息。我想以某种方式让我的机器人不仅发送消息,而且自动编辑 (SEND_MESSAGES) 频道权限给@everyone
setTimeout(function() {
client.channels.cache.get(`823225045231992892`).send('You cant send messages from now!')
}, 10000);
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);