improved messages and general cleanup

This commit is contained in:
2022-01-31 19:33:39 -06:00
parent 00d04c787d
commit fe866050d5
10 changed files with 383 additions and 228 deletions

View File

@@ -3,7 +3,8 @@ import { Client, Intents } from 'discord.js';
import * as fs from 'fs';
import { getPlayerInteraction } from './api';
import { registerCommands } from './discord';
import { cancelQueue, createQueue, joinQueue, leaveQueue, queueInfo, readyQueue } from './queue';
import { cancelQueue, createQueue, joinQueue, leaveQueue, readyQueue } from './queue';
import { errorMessage } from './util';
const CLIENT = new Client({ intents: [Intents.FLAGS.GUILDS] });
//init logs with a timestamp
@@ -39,18 +40,21 @@ CLIENT.on('interactionCreate', async interaction => {
await readyQueue(interaction);
else if (interaction.commandName === 'cancel')
await cancelQueue(interaction);
else if (interaction.commandName === 'queueinfo')
await queueInfo(interaction);
else if (interaction.commandName === 'elo')
else if (interaction.commandName === 'player')
await getPlayerInteraction(interaction);
} catch (e) {
if (typeof e === 'string') {
if (e instanceof errorMessage) {
if (interaction.deferred || interaction.replied)
interaction.editReply(e);
interaction.editReply(e.msg);
else
interaction.reply(e);
interaction.reply({
content: e.msg,
ephemeral: e.ephemeral
});
} else console.error(e);
}