added comments
This commit is contained in:
@@ -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();
|
||||||
|
|
||||||
|
|||||||
@@ -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',
|
||||||
|
|||||||
@@ -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 =>
|
||||||
|
|||||||
Reference in New Issue
Block a user