style(src/prettier): updating with the prettier
This commit is contained in:
parent
b36925546c
commit
bb46ad3996
17 changed files with 1909 additions and 1717 deletions
|
|
@ -1,51 +1,59 @@
|
|||
import { REST, Routes } from 'discord.js'
|
||||
import { pathToFileURL } from 'node:url';
|
||||
import { Client, Collection, Events, GatewayIntentBits, MessageFlags } from 'discord.js';
|
||||
import 'dotenv/config';
|
||||
import fs from 'node:fs'
|
||||
import path from 'node:path'
|
||||
import { REST, Routes } from "discord.js";
|
||||
import { pathToFileURL } from "node:url";
|
||||
import {
|
||||
Client,
|
||||
Collection,
|
||||
Events,
|
||||
GatewayIntentBits,
|
||||
MessageFlags,
|
||||
} from "discord.js";
|
||||
import "dotenv/config";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
|
||||
const client = new Client({
|
||||
intents: [
|
||||
GatewayIntentBits.Guilds
|
||||
]
|
||||
intents: [GatewayIntentBits.Guilds],
|
||||
});
|
||||
|
||||
client.commands = new Collection();
|
||||
|
||||
const commands = [];
|
||||
|
||||
const foldersPath = path.join(__dirname, '../commands');
|
||||
const foldersPath = path.join(__dirname, "../commands");
|
||||
const commandFolders = fs.readdirSync(foldersPath);
|
||||
|
||||
for (const folder of commandFolders) {
|
||||
const commandsPath = path.join(foldersPath, folder);
|
||||
const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.ts') || file.endsWith('.js'));
|
||||
for (const file of commandFiles) {
|
||||
const filesPath = path.join(commandsPath, file);
|
||||
const commandModule = await import(filesPath);
|
||||
const command = commandModule.default || commandModule;
|
||||
if ('data' in command && 'execute' in command) {
|
||||
commands.push(command.data.toJSON());
|
||||
} else {
|
||||
console.log(`⚠️ | A Command is missing a required "data" or "execute" property.`);
|
||||
}
|
||||
}
|
||||
const commandsPath = path.join(foldersPath, folder);
|
||||
const commandFiles = fs
|
||||
.readdirSync(commandsPath)
|
||||
.filter((file) => file.endsWith(".ts") || file.endsWith(".js"));
|
||||
for (const file of commandFiles) {
|
||||
const filesPath = path.join(commandsPath, file);
|
||||
const commandModule = await import(filesPath);
|
||||
const command = commandModule.default || commandModule;
|
||||
if ("data" in command && "execute" in command) {
|
||||
commands.push(command.data.toJSON());
|
||||
} else {
|
||||
console.log(
|
||||
`⚠️ | A Command is missing a required "data" or "execute" property.`,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const rest = new REST().setToken(process.env.DSC_TOKEN);
|
||||
|
||||
(async () => {
|
||||
try {
|
||||
console.log(`🔍 | ${commands.length} commands found.`);
|
||||
const data = await rest.put(
|
||||
Routes.applicationCommands(process.env.CLIENT_ID),
|
||||
{
|
||||
body: commands
|
||||
},
|
||||
);
|
||||
console.log(`✅ | ${data.length} is now reloaded`);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
try {
|
||||
console.log(`🔍 | ${commands.length} commands found.`);
|
||||
const data = await rest.put(
|
||||
Routes.applicationCommands(process.env.CLIENT_ID),
|
||||
{
|
||||
body: commands,
|
||||
},
|
||||
);
|
||||
console.log(`✅ | ${data.length} is now reloaded`);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
})();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue