diff --git a/src/api.ts b/src/api.ts index 56020ab..8990b22 100644 --- a/src/api.ts +++ b/src/api.ts @@ -151,7 +151,11 @@ export async function getPlayer(name: string): Promise { return null; } -export async function getPlayerInteraction(interaction: CommandInteraction): Promise { +/** + * calls getPlayer() with the name from the interaction + * @param interaction discord interaction + */ +export async function getPlayerInteraction(interaction: CommandInteraction) { let username = interaction.options.getString('username', true); await interaction.deferReply(); diff --git a/src/discord.ts b/src/discord.ts index 4112671..0ea2fd4 100644 --- a/src/discord.ts +++ b/src/discord.ts @@ -1,6 +1,7 @@ import { REST } from '@discordjs/rest'; import { Routes } from 'discord-api-types/v9'; +// list of commands to register with discord const commands = [ { name: 'queue', diff --git a/src/index.ts b/src/index.ts index f434ff6..32325dd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -6,8 +6,10 @@ import { registerCommands } from './discord'; import { createQueue, joinQueue, leaveQueue, queueInfo, readyQueue } from './queue'; const CLIENT = new Client({ intents: [Intents.FLAGS.GUILDS] }); +//init logs with a timestamp console.log(new Date().toISOString()+'\n\n'); +//get token if (!fs.existsSync('./token')) { fs.writeFileSync('./token', ''); console.error('Missing Discord Token, please enter the bot token into the token file'); @@ -15,6 +17,7 @@ if (!fs.existsSync('./token')) { } const TOKEN = fs.readFileSync('./token').toString(); +//discord connections CLIENT.on('ready', client => { console.log(`Logged in as ${client.user.tag}`); client.guilds.fetch().then(guilds =>