首页 > 解决方案 > 斜线命令 echo DiscordAPIError:heroku 中缺少访问权限

问题描述

//slash command to echo 
bot.on("ready", async () => {
    bot.user.setPresence({ activities: [{ name: "Tedi", type: "WATCHING"}] });
    console.log("bye");
    const data = {
        name: "echo",
        description: "Echo your text",
        options: [{
            name: "text",
            type: "STRING",
            description: "The user input",
            required: true,
        }],
    };
const command = await bot.guilds.cache.get('server id number')?.commands.create(data);
})

错误

这是我在 heroku 中收到的错误消息,我不确定缺少访问权限是什么意思。提前致谢!

标签: javascriptgithubherokudiscord.js

解决方案


这是一个很常见的问题 你可以去开发者部门

https://discord.com/developers/applications 遵循以下模式

第1步

第2步

然后复制下面的 URL 并粘贴到网页上,然后选择要创建斜杠命令的位置,就是这样!


推荐阅读