discord - 无法注册斜线命令。获取丢失访问错误
问题描述
尝试将斜杠命令添加到我的公会时,我遇到了丢失的访问错误。我已经踢了机器人,删除了机器人并改变了意图。我的意向号码是 32265
这是我添加命令的代码:
const commandFiles = await globPromise(`${process.cwd()}/commands/**/*.js`);
const arrayOfSlashCommands = [];
commandFiles.map((value) => {
const file = require(value);
const splitted = value.split("/");
const directory = splitted[splitted.length - 2];
if (file.name) {
const properties = { directory, ...file };
client.commands.set(file.name, properties);
arrayOfSlashCommands.push(file);
}
});
client.on("ready", () => {
client.guilds.cache.get("783606158669381663").commands.set(arrayOfSlashCommands);
});
但我收到了这个错误:
E:\Development\DiscordBot\Dc_v1_13_FeatureTest\node_modules\discord.js\src\rest\RequestHandler.js:298
throw new DiscordAPIError(data, res.status, request);
^
DiscordAPIError: Missing Access
at RequestHandler.execute (E:\Development\DiscordBot\Dc_v1_13_FeatureTest\node_modules\discord.js\src\rest\RequestHandler.js:298:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (E:\Development\DiscordBot\Dc_v1_13_FeatureTest\node_modules\discord.js\src\rest\RequestHandler.js:50:14)
at async GuildApplicationCommandManager.set (E:\Development\DiscordBot\Dc_v1_13_FeatureTest\node_modules\discord.js\src\managers\ApplicationCommandManager.js:146:18) {
method: 'put',
path: '/applications/893555323200237599/guilds/783606158669381663/commands',
code: 50001,
httpStatus: 403,
requestData: {
json: [
{
name: 'search',
description: 'Search',
type: undefined,
options: undefined,
default_permission: undefined
}
],
files: []
}
}
解决方案
推荐阅读
- python - 在 Pandas 中使用 Groupyby 结果中的值来命名新数据框中的列
- angular - ERROR 错误:ng-charts 配置错误,渲染图表线需要数据或数据集字段
- python - 从没有列标题的 .csv 文件中删除整列 - 简单问题
- javascript - 来自多个 csv 的谷歌图表
- xml - 使用 Shell 脚本解析 XML?
- javascript - 添加角色命令 Discord,js
- python - 如何在 JAX 中创建非全连接卷积层?
- javascript - React Hooks:尝试从事件处理程序更改 UseState 变量时,它总是会重置
- angular - 返回步进角材料的第一步
- java - 如何使用 selenium java 从调查页面单击免责声明复选框