Shavix
Shavix
DIdiscord.js - Imagine ❄
Created by Shavix on 12/3/2024 in #djs-questions
Commands don't seem to update at all
I don't know if anyone will see this, but I did make a console.log for every interactionCreate event, and when I do run a slash command, it does log the ChatInputCommandInteraction, but still no errors show up in the console or does the bot reply.
35 replies
DIdiscord.js - Imagine ❄
Created by Shavix on 12/3/2024 in #djs-questions
Commands don't seem to update at all
I will look into it
35 replies
DIdiscord.js - Imagine ❄
Created by Shavix on 12/3/2024 in #djs-questions
Commands don't seem to update at all
It does not, should I create a file for that?
35 replies
DIdiscord.js - Imagine ❄
Created by Shavix on 12/3/2024 in #djs-questions
Commands don't seem to update at all
Moving the commands into the commands folder finally registered the commands, I was just following the discord js guide and usually putting the commands into commands\utility had no problems. But now the commands aren't working and there are no errors in the console as well.
35 replies
DIdiscord.js - Imagine ❄
Created by Shavix on 12/3/2024 in #djs-questions
Commands don't seem to update at all
No description
35 replies
DIdiscord.js - Imagine ❄
Created by Shavix on 12/3/2024 in #djs-questions
Commands don't seem to update at all
It returned an empty table.
35 replies
DIdiscord.js - Imagine ❄
Created by Shavix on 12/3/2024 in #djs-questions
Commands don't seem to update at all
I hope you understand what I mean
35 replies
DIdiscord.js - Imagine ❄
Created by Shavix on 12/3/2024 in #djs-questions
Commands don't seem to update at all
I meant as in how can I get the commands I'm trying to deploy, I know about console.log
35 replies
DIdiscord.js - Imagine ❄
Created by Shavix on 12/3/2024 in #djs-questions
Commands don't seem to update at all
How should I do that?
35 replies
DIdiscord.js - Imagine ❄
Created by Shavix on 12/3/2024 in #djs-questions
Commands don't seem to update at all
No description
35 replies
DIdiscord.js - Imagine ❄
Created by Shavix on 12/3/2024 in #djs-questions
Commands don't seem to update at all
node deploy-commands.js, right?
35 replies
DIdiscord.js - Imagine ❄
Created by Shavix on 12/3/2024 in #djs-questions
Commands don't seem to update at all
A billion times.
35 replies
DIdiscord.js - Imagine ❄
Created by Shavix on 12/3/2024 in #djs-questions
Commands don't seem to update at all
No description
35 replies
DIdiscord.js - Imagine ❄
Created by Shavix on 12/3/2024 in #djs-questions
Commands don't seem to update at all
index.js:
// Require the necessary discord.js classes
const { Client, Events, GatewayIntentBits, REST, Routes } = require('discord.js');
require('dotenv').config(); // Load environment variables from .env file
const token = process.env.TOKEN;

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

// When the client is ready, run this code (only once).
// The distinction between `client: Client<boolean>` and `readyClient: Client<true>` is important for TypeScript developers.
// It makes some properties non-nullable.
client.once(Events.ClientReady, readyClient => {
console.log(`Ready! Logged in as ${readyClient.user.tag}`);
});

// Log in to Discord with your client's token
client.login(token);
// Require the necessary discord.js classes
const { Client, Events, GatewayIntentBits, REST, Routes } = require('discord.js');
require('dotenv').config(); // Load environment variables from .env file
const token = process.env.TOKEN;

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

// When the client is ready, run this code (only once).
// The distinction between `client: Client<boolean>` and `readyClient: Client<true>` is important for TypeScript developers.
// It makes some properties non-nullable.
client.once(Events.ClientReady, readyClient => {
console.log(`Ready! Logged in as ${readyClient.user.tag}`);
});

// Log in to Discord with your client's token
client.login(token);
deploy-commands.js:
const { REST, Routes } = require('discord.js');
const fs = require('fs');
require('dotenv').config(); // Load environment variables from .env file

// Get all commands from the commands folder
const commands = [];
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));

// Loop over all the files in the commands folder and add them to the commands array
for (const file of commandFiles) {
const command = require(`./commands/${file}`);
commands.push(command.data.toJSON());
}

// Create a new REST instance
const rest = new REST({ version: '9' }).setToken(process.env.TOKEN);

// Refresh the commands
(async () => {
try {
console.log('Started refreshing application (/) commands.');
// Put the commands in the guild
await rest.put(
Routes.applicationGuildCommands(process.env.CLIENT_ID, process.env.GUILD_ID),
{ body: commands },
);

console.log('Successfully reloaded application (/) commands.');
} catch (error) {
// Catch any errors and log them to the console
console.error(error);
}
})();
const { REST, Routes } = require('discord.js');
const fs = require('fs');
require('dotenv').config(); // Load environment variables from .env file

// Get all commands from the commands folder
const commands = [];
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));

// Loop over all the files in the commands folder and add them to the commands array
for (const file of commandFiles) {
const command = require(`./commands/${file}`);
commands.push(command.data.toJSON());
}

// Create a new REST instance
const rest = new REST({ version: '9' }).setToken(process.env.TOKEN);

// Refresh the commands
(async () => {
try {
console.log('Started refreshing application (/) commands.');
// Put the commands in the guild
await rest.put(
Routes.applicationGuildCommands(process.env.CLIENT_ID, process.env.GUILD_ID),
{ body: commands },
);

console.log('Successfully reloaded application (/) commands.');
} catch (error) {
// Catch any errors and log them to the console
console.error(error);
}
})();
35 replies