javascript - 如何让我的不和谐机器人更新频道权限作为一项操作?
问题描述
所以我在这里确实有这个简单的功能,我的机器人在 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);
推荐阅读
- c# - 如何将变量从控制器传递到视图
- hadoop - 将以 orc 格式存储的 Hive 表从本地 HDFS 传输到 Google Cloud Storage
- python-3.x - Windows 10 SSL 证书验证失败
- angular - 执行错误后 Ngrx 操作未完成
- amazon-web-services - 使用 CloudFormation Designer 自动生成 CF 模板可视化
- angular - 将 Angular 5 升级到 6 后出错,VSTS 构建
- ios - 带有自定义 UITextField 选项的 UIPickerView
- c# - 所有流量的 WebApi 自定义路由
- custom-controls - Cognos 11 javascript实现onkeyup
- android - JavaFX ScrollPane 在 Android 设备上非常慢