bug fixes in /wiki

This commit is contained in:
Yusur 2025-01-17 11:22:08 +01:00
parent 4b8fa012da
commit d60d2cd477
6 changed files with 68 additions and 17 deletions

View file

@ -21,6 +21,8 @@ import { GatewayIntentBits, Events, Interaction, ChatInputCommandInteraction } f
import { MyClient } from './client';
import commandList from './commandList';
import chalk from 'chalk';
const client = new MyClient({
intents: [
GatewayIntentBits.Guilds
@ -33,17 +35,19 @@ for (let command of commandList) {
client.on(Events.InteractionCreate, async (interaction: Interaction) => {
if (interaction instanceof ChatInputCommandInteraction) {
let command = client.commands.get(interaction.commandName);
const { commandName } = interaction;
let command = client.commands.get(commandName);
try {
await command.execute(interaction);
} catch (ex) {
console.error(`${chalk.red('Error in command')} ${chalk.bold(`/${commandName}`)}`);
console.error(ex);
}
}
});
client.once(Events.ClientReady, async () => {
console.log(`Logged in as \x1b[1m${client.user.tag}\x1b[22m`);
console.log(`Logged in as ${chalk.bold(client.user.tag)}`);
})
client.login(process.env.TOKEN);