jibz
jibz
DIdiscord.js - Imagine ❄
Created by jibz on 3/5/2024 in #djs-questions
Bot will not push new commands to server
thx
33 replies
DIdiscord.js - Imagine ❄
Created by jibz on 3/5/2024 in #djs-questions
Bot will not push new commands to server
ok
33 replies
DIdiscord.js - Imagine ❄
Created by jibz on 3/5/2024 in #djs-questions
Bot will not push new commands to server
ty
33 replies
DIdiscord.js - Imagine ❄
Created by jibz on 3/5/2024 in #djs-questions
Bot will not push new commands to server
its fixed btw
33 replies
DIdiscord.js - Imagine ❄
Created by jibz on 3/5/2024 in #djs-questions
Bot will not push new commands to server
where should i put it
33 replies
DIdiscord.js - Imagine ❄
Created by jibz on 3/5/2024 in #djs-questions
Bot will not push new commands to server
:/
33 replies
DIdiscord.js - Imagine ❄
Created by jibz on 3/5/2024 in #djs-questions
Bot will not push new commands to server
lemme see if
33 replies
DIdiscord.js - Imagine ❄
Created by jibz on 3/5/2024 in #djs-questions
Bot will not push new commands to server
i moved from repl forgot to change that
33 replies
DIdiscord.js - Imagine ❄
Created by jibz on 3/5/2024 in #djs-questions
Bot will not push new commands to server
oh my fucking god im an idiot..
33 replies
DIdiscord.js - Imagine ❄
Created by jibz on 3/5/2024 in #djs-questions
Bot will not push new commands to server
process.env.token
33 replies
DIdiscord.js - Imagine ❄
Created by jibz on 3/5/2024 in #djs-questions
Bot will not push new commands to server
I had my
33 replies
DIdiscord.js - Imagine ❄
Created by jibz on 3/5/2024 in #djs-questions
Bot will not push new commands to server
Oh wait..
33 replies
DIdiscord.js - Imagine ❄
Created by jibz on 3/5/2024 in #djs-questions
Bot will not push new commands to server
yeah it is
33 replies
DIdiscord.js - Imagine ❄
Created by jibz on 3/5/2024 in #djs-questions
Bot will not push new commands to server
this is the code
33 replies
DIdiscord.js - Imagine ❄
Created by jibz on 3/5/2024 in #djs-questions
Bot will not push new commands to server
oh crap
33 replies
DIdiscord.js - Imagine ❄
Created by jibz on 3/5/2024 in #djs-questions
Bot will not push new commands to server
handlecommands.js

const { REST } = require("@discordjs/rest");
const { Routes } = require('discord-api-types/v9');
const fs = require('fs');

const clientId = '1214333260960628817';
const guildId = '1214331914769670154';

module.exports = (client) => {
client.handleCommands = async (commandFolders, path) => {
client.commandArray = [];
for (folder of commandFolders) {
const commandFiles = fs.readdirSync(`${path}/${folder}`).filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const command = require(`../commands/${folder}/${file}`);
console.log(`${command.data.name} pushed`)
client.commands.set(command.data.name, command);
client.commandArray.push(command.data.toJSON());
}
}

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

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

await rest.put(
Routes.applicationCommands(clientId), {
body: client.commandArray
},
);

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

const { REST } = require("@discordjs/rest");
const { Routes } = require('discord-api-types/v9');
const fs = require('fs');

const clientId = '1214333260960628817';
const guildId = '1214331914769670154';

module.exports = (client) => {
client.handleCommands = async (commandFolders, path) => {
client.commandArray = [];
for (folder of commandFolders) {
const commandFiles = fs.readdirSync(`${path}/${folder}`).filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const command = require(`../commands/${folder}/${file}`);
console.log(`${command.data.name} pushed`)
client.commands.set(command.data.name, command);
client.commandArray.push(command.data.toJSON());
}
}

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

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

await rest.put(
Routes.applicationCommands(clientId), {
body: client.commandArray
},
);

console.log('Successfully reloaded application (/) commands.');
} catch (error) {
console.error(error);
}
})();
};
};
33 replies
DIdiscord.js - Imagine ❄
Created by jibz on 3/5/2024 in #djs-questions
Bot will not push new commands to server
handle commands?
33 replies
DIdiscord.js - Imagine ❄
Created by jibz on 3/5/2024 in #djs-questions
Bot will not push new commands to server
what code do u want to see
33 replies
DIdiscord.js - Imagine ❄
Created by jibz on 3/5/2024 in #djs-questions
Bot will not push new commands to server
const { Client, GatewayIntentBits, EmbedBuilder, PermissionsBitField, Permissions, MessageManager, Embed, Collection } = require(`discord.js`);
const fs = require('fs');
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent, GatewayIntentBits.GuildMembers] });

client.commands = new Collection();

require('dotenv').config();

const functions = fs.readdirSync("./functions").filter(file => file.endsWith(".js"));
const eventFiles = fs.readdirSync("./events").filter(file => file.endsWith(".js"));
const commandFolders = fs.readdirSync("./commands");



(async () => {
for (file of functions) {
require(`./functions/${file}`)(client);
}
client.handleEvents(eventFiles, "./events");
client.handleCommands(commandFolders, "./commands");
})();

client.login(".nonononoonon.bny")
const { Client, GatewayIntentBits, EmbedBuilder, PermissionsBitField, Permissions, MessageManager, Embed, Collection } = require(`discord.js`);
const fs = require('fs');
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent, GatewayIntentBits.GuildMembers] });

client.commands = new Collection();

require('dotenv').config();

const functions = fs.readdirSync("./functions").filter(file => file.endsWith(".js"));
const eventFiles = fs.readdirSync("./events").filter(file => file.endsWith(".js"));
const commandFolders = fs.readdirSync("./commands");



(async () => {
for (file of functions) {
require(`./functions/${file}`)(client);
}
client.handleEvents(eventFiles, "./events");
client.handleCommands(commandFolders, "./commands");
})();

client.login(".nonononoonon.bny")
33 replies
DIdiscord.js - Imagine ❄
Created by jibz on 3/5/2024 in #djs-questions
Bot will not push new commands to server
wait
33 replies