VeebS
VeebS
DIAdiscord.js - Imagine an app
Created by VeebS on 11/22/2024 in #djs-questions
Registration Request on Startup
@treble/luna Okay I got it, appreciate the help everyone
81 replies
DIAdiscord.js - Imagine an app
Created by VeebS on 11/22/2024 in #djs-questions
Registration Request on Startup
Sorry lol
81 replies
DIAdiscord.js - Imagine an app
Created by VeebS on 11/22/2024 in #djs-questions
Registration Request on Startup
I’m still a bit confused but I’ll try work it out
81 replies
DIAdiscord.js - Imagine an app
Created by VeebS on 11/22/2024 in #djs-questions
Registration Request on Startup
I'm saying if I run the script on my local computer, how would it update on my online host (where the bot is hosted)
81 replies
DIAdiscord.js - Imagine an app
Created by VeebS on 11/22/2024 in #djs-questions
Registration Request on Startup
I know.. 😂
81 replies
DIAdiscord.js - Imagine an app
Created by VeebS on 11/22/2024 in #djs-questions
Registration Request on Startup
How would that update the commands on the host though?
81 replies
DIAdiscord.js - Imagine an app
Created by VeebS on 11/22/2024 in #djs-questions
Registration Request on Startup
I think I understand but please explain cause I'm still learning lmao
81 replies
DIAdiscord.js - Imagine an app
Created by VeebS on 11/22/2024 in #djs-questions
Registration Request on Startup
No description
81 replies
DIAdiscord.js - Imagine an app
Created by VeebS on 11/22/2024 in #djs-questions
Registration Request on Startup
Wdym? I'm just using the normal console
81 replies
DIAdiscord.js - Imagine an app
Created by VeebS on 11/22/2024 in #djs-questions
Registration Request on Startup
@sïř.jõ 🌈 The bot launches fine now 🙂 Only thing is, when i type 'npm run deploy' in the console it doesnt do anything
81 replies
DIAdiscord.js - Imagine an app
Created by VeebS on 11/22/2024 in #djs-questions
Registration Request on Startup
Ok thank you ill give it a shot after i eat
81 replies
DIAdiscord.js - Imagine an app
Created by VeebS on 11/22/2024 in #djs-questions
Registration Request on Startup
No you're all good, let me do this script and remove the registration from index.js and ill see if that allows the bot to launch properly, i have restarted the BOT A LOT so it couldnt legimately just be rate limitting So do i just put this script below into the 'scripts' section of package.json ? Its saying to create a deploy-commands.js , so which one do i do?
const { REST, Routes } = require('discord.js');
const { clientId, guildId, token } = require('./config.json');
const fs = require('node:fs');
const path = require('node:path');

const commands = [];
// Grab all the command folders from the commands directory you created earlier
const foldersPath = path.join(__dirname, 'commands');
const commandFolders = fs.readdirSync(foldersPath);

for (const folder of commandFolders) {
// Grab all the command files from the commands directory you created earlier
const commandsPath = path.join(foldersPath, folder);
const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js'));
// Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment
for (const file of commandFiles) {
const filePath = path.join(commandsPath, file);
const command = require(filePath);
if ('data' in command && 'execute' in command) {
commands.push(command.data.toJSON());
} else {
console.log(`[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`);
}
}
}

// Construct and prepare an instance of the REST module
const rest = new REST().setToken(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.applicationGuildCommands(clientId, guildId),
{ body: commands },
);

console.log(`Successfully reloaded ${data.length} application (/) commands.`);
} catch (error) {
// And of course, make sure you catch and log any errors!
console.error(error);
}
})();
const { REST, Routes } = require('discord.js');
const { clientId, guildId, token } = require('./config.json');
const fs = require('node:fs');
const path = require('node:path');

const commands = [];
// Grab all the command folders from the commands directory you created earlier
const foldersPath = path.join(__dirname, 'commands');
const commandFolders = fs.readdirSync(foldersPath);

for (const folder of commandFolders) {
// Grab all the command files from the commands directory you created earlier
const commandsPath = path.join(foldersPath, folder);
const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js'));
// Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment
for (const file of commandFiles) {
const filePath = path.join(commandsPath, file);
const command = require(filePath);
if ('data' in command && 'execute' in command) {
commands.push(command.data.toJSON());
} else {
console.log(`[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`);
}
}
}

// Construct and prepare an instance of the REST module
const rest = new REST().setToken(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.applicationGuildCommands(clientId, guildId),
{ body: commands },
);

console.log(`Successfully reloaded ${data.length} application (/) commands.`);
} catch (error) {
// And of course, make sure you catch and log any errors!
console.error(error);
}
})();
81 replies
DIAdiscord.js - Imagine an app
Created by VeebS on 11/22/2024 in #djs-questions
Registration Request on Startup
gotcha
81 replies
DIAdiscord.js - Imagine an app
Created by VeebS on 11/22/2024 in #djs-questions
Registration Request on Startup
No description
81 replies
DIAdiscord.js - Imagine an app
Created by VeebS on 11/22/2024 in #djs-questions
Registration Request on Startup
Let me remove the registration sequence and update it as a script and see if that fixes it
81 replies
DIAdiscord.js - Imagine an app
Created by VeebS on 11/22/2024 in #djs-questions
Registration Request on Startup
No description
81 replies
DIAdiscord.js - Imagine an app
Created by VeebS on 11/22/2024 in #djs-questions
Registration Request on Startup
Thanks, and yes I have. Now that I'm looking though the bot isnt actually starting
81 replies
DIAdiscord.js - Imagine an app
Created by VeebS on 11/22/2024 in #djs-questions
Registration Request on Startup
How would that script work, would it pretty much be the same as what I have in my index.js? I haven't touched scripts in package.json worried I'd mess it up lmao
81 replies
DIAdiscord.js - Imagine an app
Created by VeebS on 11/22/2024 in #djs-questions
Registration Request on Startup
Same lol
81 replies
DIAdiscord.js - Imagine an app
Created by VeebS on 11/22/2024 in #djs-questions
Registration Request on Startup
Ok so like a /register command that pushes the registration through?
81 replies