Ryan
Ryan
DIAdiscord.js - Imagine an app
Created by Ryan on 2/4/2024 in #djs-questions
Slash command setting not working
In a last-ditch effort, I just CTRL+R to refresh discord and I see the updated commands. I have to refresh every time to see the updates? I guess I'm just stupid then lmao
21 replies
DIAdiscord.js - Imagine an app
Created by Ryan on 2/4/2024 in #djs-questions
Slash command setting not working
Ahh.
21 replies
DIAdiscord.js - Imagine an app
Created by Ryan on 2/4/2024 in #djs-questions
Slash command setting not working
And I clicked off and back on
21 replies
DIAdiscord.js - Imagine an app
Created by Ryan on 2/4/2024 in #djs-questions
Slash command setting not working
(that screenshot is in a server btw, not DMs)
21 replies
DIAdiscord.js - Imagine an app
Created by Ryan on 2/4/2024 in #djs-questions
Slash command setting not working
What I was using to previously register commands worked, but when I updated to 14.14.1, it busted
21 replies
DIAdiscord.js - Imagine an app
Created by Ryan on 2/4/2024 in #djs-questions
Slash command setting not working
It hasn't updated though: https://fyi.cx/MYPqGbG.png
21 replies
DIAdiscord.js - Imagine an app
Created by Ryan on 2/4/2024 in #djs-questions
Slash command setting not working
21 replies
DIAdiscord.js - Imagine an app
Created by Ryan on 2/4/2024 in #djs-questions
Slash command setting not working
That's the new code. I removed the permissions as well. Should I keep it in?
21 replies
DIAdiscord.js - Imagine an app
Created by Ryan on 2/4/2024 in #djs-questions
Slash command setting not working
require('dotenv').config();
const fs = require('fs');
const { Client, GatewayIntentBits, PermissionsBitField, REST, Routes } = require('discord.js');
const { Logger, Level } = require('./util/logger.js');

const client = new Client({ intents: [GatewayIntentBits.Guilds] });

// Initialize commands
const commands = new Map();

// Builds the list of commands to set
const commandList = [];

const commandPaths = fs.readdirSync('./commands');
for(const commandPath of commandPaths) {
const command = require(`./commands/${ commandPath }`);
commandList.push({
name: command.name,
description: command.description,
options: command.options
//defaultMemberPermissions: PermissionsBitField.Default
});
commands.set(command.name, command.obj);
Logger.log(Level.INFO, `Command initialized successfully: ${ command.name }`);
}

// Construct and prepare an instance of the REST module
const rest = new REST().setToken(process.env.DISCORD_TOKEN);

// and deploy your commands!
(async () => {
try {
console.log(`Started refreshing ${commands.length} application (/) commands.`);

// The put method is used to fully refresh all commands in the guild with the current set
const data = await rest.put(
Routes.applicationCommands(process.env.DISCORD_APP_ID),
{ body: commandList },
);

console.log(`Successfully reloaded ${data.length} application (/) commands.`);
} catch (error) {
// And of course, make sure you catch and log any errors!
console.error(error);
}
})();

client.on('ready', async () => {
// Set the commands for the bot
//console.log(await client.application.commands.set(commandList));
//Logger.log(Level.INFO, 'Commands successfully sent to Discord.');

Logger.log(Level.INFO, 'Bot started successfully!');
});
require('dotenv').config();
const fs = require('fs');
const { Client, GatewayIntentBits, PermissionsBitField, REST, Routes } = require('discord.js');
const { Logger, Level } = require('./util/logger.js');

const client = new Client({ intents: [GatewayIntentBits.Guilds] });

// Initialize commands
const commands = new Map();

// Builds the list of commands to set
const commandList = [];

const commandPaths = fs.readdirSync('./commands');
for(const commandPath of commandPaths) {
const command = require(`./commands/${ commandPath }`);
commandList.push({
name: command.name,
description: command.description,
options: command.options
//defaultMemberPermissions: PermissionsBitField.Default
});
commands.set(command.name, command.obj);
Logger.log(Level.INFO, `Command initialized successfully: ${ command.name }`);
}

// Construct and prepare an instance of the REST module
const rest = new REST().setToken(process.env.DISCORD_TOKEN);

// and deploy your commands!
(async () => {
try {
console.log(`Started refreshing ${commands.length} application (/) commands.`);

// The put method is used to fully refresh all commands in the guild with the current set
const data = await rest.put(
Routes.applicationCommands(process.env.DISCORD_APP_ID),
{ body: commandList },
);

console.log(`Successfully reloaded ${data.length} application (/) commands.`);
} catch (error) {
// And of course, make sure you catch and log any errors!
console.error(error);
}
})();

client.on('ready', async () => {
// Set the commands for the bot
//console.log(await client.application.commands.set(commandList));
//Logger.log(Level.INFO, 'Commands successfully sent to Discord.');

Logger.log(Level.INFO, 'Bot started successfully!');
});
21 replies
DIAdiscord.js - Imagine an app
Created by Ryan on 2/4/2024 in #djs-questions
Slash command setting not working
Should it register in guilds/dms right away? Or do I have to wait a certain time?
21 replies
DIAdiscord.js - Imagine an app
Created by Ryan on 2/4/2024 in #djs-questions
Slash command setting not working
Also, thanks for the help! :)
21 replies
DIAdiscord.js - Imagine an app
Created by Ryan on 2/4/2024 in #djs-questions
Slash command setting not working
One second. Let me change my code back to register before.
21 replies
DIAdiscord.js - Imagine an app
Created by Ryan on 2/4/2024 in #djs-questions
Slash command setting not working
And is the client ID my bot's application ID?
21 replies
DIAdiscord.js - Imagine an app
Created by Ryan on 2/4/2024 in #djs-questions
Slash command setting not working
I tried this before too, but I didn't get it work
21 replies