how to fix DiscordAPIError[50001] OAuth2 problem?

well my problem in this case isn´t the code, because i´m using the direct code from the most recent version of discord.js documentation (v13.3.1). i readed i need to check the scope "applications.commands" in the OAuth2 settings in Discord Developers portal Bot Panel.

In OAuth2 > General > Default Authorization Link

In the Authorization method i selected "in-app Authorization" and i checked the "bot" and "applications.commands" scopes, because i´m learning the permissions of the bot are "administrator"

In OAuth2 > GenerateUrl

In this section to make the invitation link i only selected the scope "Bot" because when i try to select "applications.commands" scope, Discord ask me about a redirect URL, and in my case i don´t have a website, and for now i don´t wanna to create it, i´m not sure if this is really necessary and in that case i don´t know if there other way to register Slash commands, in any case, if someone needs to see the code, this is it:

const { clientId, guildId, token } = require('./config.json');
const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');

const commands = [{
    name: 'ping',
    description: 'Replies with Pong!'
}];

const rest = new REST({ version: '9' }).setToken(token);

(async () => {
    try {
        console.log('Started refreshing application (/) commands.');

        await rest.put(
            Routes.applicationGuildCommands(clientId, guildId),
            { body: commands },
        );

        console.log('Successfully reloaded application (/) commands.');
    } catch (error) {
        console.error(error);
    }
})();

I hope someone can help me with this, thank you very much.



from Recent Questions - Stack Overflow https://ift.tt/3rqoIhB
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Hibernate Search - Elasticsearch with JSON manipulation

Spring Elasticsearch Operations