Dustshader
Dustshader
DIAdiscord.js - Imagine an app
Created by Dustshader on 12/9/2023 in #djs-questions
reload command on new sever
i was watching a yt video that was using this guide
9 replies
DIAdiscord.js - Imagine an app
Created by Dustshader on 12/9/2023 in #djs-questions
reload command on new sever
const { Client, Collection } = require('discord.js');
const { promisify } = require("util");
const { glob } = require("glob");
const Ascii = require("ascii-table");
const client = new Client({
intents: 131071,
partials: ["MESSAGE", "CHANNEL", "REACTION"]
});
const { Token, STATUS } = require("./config.json");

client.commands = new Collection();

// Define PG using promisify and glob
const PG = promisify(glob);

module.exports = client;

["Events", "Commands"].forEach(handler => {
require(`../Handlers/${handler}`)(client, PG, Ascii)
});


client.login(Token);
const { Client, Collection } = require('discord.js');
const { promisify } = require("util");
const { glob } = require("glob");
const Ascii = require("ascii-table");
const client = new Client({
intents: 131071,
partials: ["MESSAGE", "CHANNEL", "REACTION"]
});
const { Token, STATUS } = require("./config.json");

client.commands = new Collection();

// Define PG using promisify and glob
const PG = promisify(glob);

module.exports = client;

["Events", "Commands"].forEach(handler => {
require(`../Handlers/${handler}`)(client, PG, Ascii)
});


client.login(Token);
9 replies
DIAdiscord.js - Imagine an app
Created by Dustshader on 12/9/2023 in #djs-questions
reload command on new sever
ok maybe i dont have that
const config = require("../Structures/config.json")
const { Perms } = require("../Validation/Permissions");
const { Client, ClientUser } = require("discord.js");

/**
* @param {Client} client
*/
module.exports = async (client,PG, Ascii) => {
const Table = new Ascii("Command Loaded")

CommandsArray = [];

(await PG(`${process.cwd()}/Commands/*/*.js`)).map(async (file) => {
const command = require(file);
if(!command.name)
return Table.addRow(file.split("/")[7], "❌ FAILED", "Missing a name.")

if (command.type !== "USER" && !command.description)
return Table.addRow(command.name, "🔸 FAILED", "missing a description.");

if(command.permission) {
if(Perms.includes(command.permission))
command.defaultPermission = false;
else
return Table.addRow(command.name, "❌ FAILED", "Permission invalid.")
}

client.commands.set(command.name, command);
CommandsArray.push(command);

await Table.addRow(command.name, "✔ SUCCESSFUL");

});

console.log(Table.toString());

client.on('ready', async () => {
client.guilds.cache.forEach((guild) => {
guild.commands.cache.delete();
guild.commands.set(CommandsArray);
})
});
};
//const MainGuild = await client.guilds.cache.get(config.ServerID);
//MainGuild.commands.set(CommandsArray);
const config = require("../Structures/config.json")
const { Perms } = require("../Validation/Permissions");
const { Client, ClientUser } = require("discord.js");

/**
* @param {Client} client
*/
module.exports = async (client,PG, Ascii) => {
const Table = new Ascii("Command Loaded")

CommandsArray = [];

(await PG(`${process.cwd()}/Commands/*/*.js`)).map(async (file) => {
const command = require(file);
if(!command.name)
return Table.addRow(file.split("/")[7], "❌ FAILED", "Missing a name.")

if (command.type !== "USER" && !command.description)
return Table.addRow(command.name, "🔸 FAILED", "missing a description.");

if(command.permission) {
if(Perms.includes(command.permission))
command.defaultPermission = false;
else
return Table.addRow(command.name, "❌ FAILED", "Permission invalid.")
}

client.commands.set(command.name, command);
CommandsArray.push(command);

await Table.addRow(command.name, "✔ SUCCESSFUL");

});

console.log(Table.toString());

client.on('ready', async () => {
client.guilds.cache.forEach((guild) => {
guild.commands.cache.delete();
guild.commands.set(CommandsArray);
})
});
};
//const MainGuild = await client.guilds.cache.get(config.ServerID);
//MainGuild.commands.set(CommandsArray);
9 replies
DIAdiscord.js - Imagine an app
Created by Dustshader on 12/9/2023 in #djs-questions
reload command on new sever
what file are you looking for
9 replies
DIAdiscord.js - Imagine an app
Created by Dustshader on 12/9/2023 in #djs-questions
reload command on new sever
i followed that tho, thats why im confused
9 replies
DIAdiscord.js - Imagine an app
Created by Dustshader on 12/9/2023 in #djs-questions
reload command on new sever
how do i do that
9 replies