Drithyl
Drithyl
DIAdiscord.js - Imagine an app
Created by Drithyl on 3/10/2024 in #djs-questions
Is there a way to check if the bot has the applications.commands scope in a given guild?
As title says, is there any way to check this? Either through DiscordJS itself, or I'd settle for settings on Discord or on the My Applications menu. More specifically, I've registered global slash commands but they do not appear in the guilds in which the bot is. I've tried weeding out any other causes but everything else seems to be correct, so I'm leaning towards the commands not showing as a result of this missing scope.
6 replies
DIAdiscord.js - Imagine an app
Created by Drithyl on 1/2/2023 in #djs-questions
IntentsBitField is not a constructor
I'm following this part of the guide: https://discordjs.guide/popular-topics/intents.html#enabling-intents Below is the code that I'm using to create an instance of the Client with the right intents:
// Require the necessary discord.js classes
const { Client, IntentsBitField } = require("discord.js");
const intents = new IntentsBitField();

intents.add(
IntentsBitField.Flags.Guilds,
IntentsBitField.Flags.GuildMembers,
IntentsBitField.Flags.GuildMessages,
IntentsBitField.Flags.GuildMessageReactions,
IntentsBitField.Flags.DirectMessages,
IntentsBitField.Flags.DirectMessageReactions
);

// Create a new client instance with the correct intents. See:
// https://discordjs.guide/popular-topics/intents.html#error-disallowed-intents
const client = new Client({ intents });
// Require the necessary discord.js classes
const { Client, IntentsBitField } = require("discord.js");
const intents = new IntentsBitField();

intents.add(
IntentsBitField.Flags.Guilds,
IntentsBitField.Flags.GuildMembers,
IntentsBitField.Flags.GuildMessages,
IntentsBitField.Flags.GuildMessageReactions,
IntentsBitField.Flags.DirectMessages,
IntentsBitField.Flags.DirectMessageReactions
);

// Create a new client instance with the correct intents. See:
// https://discordjs.guide/popular-topics/intents.html#error-disallowed-intents
const client = new Client({ intents });
When I run the code, I get the following error stack:
{
"stack": "TypeError: IntentsBitField is not a constructor
at Object.create (E:\\GitHub\\MrClockwork-v4-indev\\discord\\client.js:7:18)
at initializeClient (E:\\GitHub\\MrClockwork-v4-indev\\discord\\index.js:17:34)
at Object.exports.startDiscordIntegration (E:\\GitHub\\MrClockwork-v4-indev\\discord\\index.js:7:26)
at _initializeComponents (E:\\GitHub\\MrClockwork-v4-indev\\app_bot.js:67:23)",
"message": "IntentsBitField is not a constructor"
}
{
"stack": "TypeError: IntentsBitField is not a constructor
at Object.create (E:\\GitHub\\MrClockwork-v4-indev\\discord\\client.js:7:18)
at initializeClient (E:\\GitHub\\MrClockwork-v4-indev\\discord\\index.js:17:34)
at Object.exports.startDiscordIntegration (E:\\GitHub\\MrClockwork-v4-indev\\discord\\index.js:7:26)
at _initializeComponents (E:\\GitHub\\MrClockwork-v4-indev\\app_bot.js:67:23)",
"message": "IntentsBitField is not a constructor"
}
I'm running Discord v13.12. I'm not sure what the problem is.
3 replies
DIAdiscord.js - Imagine an app
Created by Drithyl on 12/5/2022 in #djs-questions
Where can I find the SlashCommandBuilder and all related subfunctions in the documentation?
I can't seem to find any of the functions in https://discord.js.org/#/docs/discord.js/main/general/welcome Trying to find the details of the .addIntegerOption() subfunctions, so I can figure out how to add min/max values to the option.
5 replies