added comments

This commit is contained in:
2022-01-31 14:24:29 -06:00
parent a3a7acf9a8
commit 5167a25626
3 changed files with 9 additions and 1 deletions

View File

@@ -151,7 +151,11 @@ export async function getPlayer(name: string): Promise<uniteApiData|null> {
return null; return null;
} }
export async function getPlayerInteraction(interaction: CommandInteraction): Promise<void> { /**
* 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); let username = interaction.options.getString('username', true);
await interaction.deferReply(); await interaction.deferReply();

View File

@@ -1,6 +1,7 @@
import { REST } from '@discordjs/rest'; import { REST } from '@discordjs/rest';
import { Routes } from 'discord-api-types/v9'; import { Routes } from 'discord-api-types/v9';
// list of commands to register with discord
const commands = [ const commands = [
{ {
name: 'queue', name: 'queue',

View File

@@ -6,8 +6,10 @@ import { registerCommands } from './discord';
import { createQueue, joinQueue, leaveQueue, queueInfo, readyQueue } from './queue'; import { createQueue, joinQueue, leaveQueue, queueInfo, readyQueue } from './queue';
const CLIENT = new Client({ intents: [Intents.FLAGS.GUILDS] }); const CLIENT = new Client({ intents: [Intents.FLAGS.GUILDS] });
//init logs with a timestamp
console.log(new Date().toISOString()+'\n\n'); console.log(new Date().toISOString()+'\n\n');
//get token
if (!fs.existsSync('./token')) { if (!fs.existsSync('./token')) {
fs.writeFileSync('./token', ''); fs.writeFileSync('./token', '');
console.error('Missing Discord Token, please enter the bot token into the token file'); 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(); const TOKEN = fs.readFileSync('./token').toString();
//discord connections
CLIENT.on('ready', client => { CLIENT.on('ready', client => {
console.log(`Logged in as ${client.user.tag}`); console.log(`Logged in as ${client.user.tag}`);
client.guilds.fetch().then(guilds => client.guilds.fetch().then(guilds =>