node.js - DiscordAPIError:缺少权限
问题描述
当我试图用Discord.js禁止某人时,会出现此错误:
(node:10656) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions
at RequestHandler.execute (C:\Users\Admin\Desktop\DiscordBot\node_modules\discord.js\src\rest\RequestHandler.js:154:13)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async RequestHandler.push (C:\Users\Admin\Desktop\DiscordBot\node_modules\discord.js\src\rest\RequestHandler.js:39:14)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:10656) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:10656) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
带代码:
var memberID = message.guild.members.cache.get(target.id);
memberID.ban();
我的机器人拥有所有权限,并且我在 Discord 上进行了两步验证。有人能帮我吗?
解决方案
推荐阅读
- go - 从另一个本地包导入本地包
- python - Python - 适合胶合文件的矩阵
- react-native - Instabug setStringToKey 获取默认字符串值
- javascript - 使用回调分配 React ref 与直接设置它之间的区别?
- python - 如何制作包含方程式的函数并将其应用于不同的数据帧?
- airflow - 气流 - 上次运行不正确
- powershell - 无法重命名,因为项目不存在
- c++ - Qt Creator:创建封装第三方库的安装程序
- java - 如何使用@Autowired 字段测试通用抽象类?
- angular - 为什么 *ngFor 循环会破坏 Internet Explorer 中的侧边栏动画?