From e62c5e972e069ceda3f8e75f4fbd7c442d8fb22f Mon Sep 17 00:00:00 2001 From: AnxietyisReal <96593068+AnxietyisReal@users.noreply.github.com> Date: Sun, 20 Aug 2023 11:04:14 +1000 Subject: [PATCH] Only display one server for now --- src/client.ts | 2 +- src/commands/mp.ts | 108 ++++++++++++++++++++++----------------------- 2 files changed, 53 insertions(+), 57 deletions(-) diff --git a/src/client.ts b/src/client.ts index 21e8f5d..5d261f6 100644 --- a/src/client.ts +++ b/src/client.ts @@ -90,7 +90,7 @@ export default class TClient extends Client { this.tags = new tags(this); this.repeatedMessages = {}; this.setMaxListeners(45); - this.statsGraph = -60; + this.statsGraph = -120; } async init(){ console.time('Startup'); diff --git a/src/commands/mp.ts b/src/commands/mp.ts index 410430d..7ccb9b8 100644 --- a/src/commands/mp.ts +++ b/src/commands/mp.ts @@ -5,6 +5,11 @@ import canvas from 'canvas'; import {readFileSync} from 'node:fs'; import {FSData, TServer} from 'src/typings/interfaces.js'; +const serverChoices = [ + {name: 'Main Server', value: 'mainServer'}, + {name: 'Second Server', value: 'secondServer'} +] + export default { async run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){ if (client.uptime < 30000) return interaction.reply('I have just restarted, please wait for MPLoop to finish initializing.') @@ -246,60 +251,51 @@ export default { })[interaction.options.getSubcommand()](); }, data: new Discord.SlashCommandBuilder() - .setName('mp') - .setDescription('Display MP status and other things') - .addSubcommand(x=>x - .setName('status') - .setDescription('Display server status') - .addStringOption(x=>x - .setName('server') - .setDescription('The server to update') - .setRequired(true) - .setChoices( - {name: 'Main Server', value: 'mainServer'}, - {name: 'Second Server', value: 'secondServer'} - ))) - .addSubcommand(x=>x - .setName('players') - .setDescription('Display players on server') - .addStringOption(x=>x - .setName('server') - .setDescription('The server to display players for') - .setRequired(true) - .setChoices( - {name: 'Main Server', value: 'mainServer'}, - {name: 'Second Server', value: 'secondServer'} - ))) - .addSubcommand(x=>x - .setName('url') - .setDescription('View or update the server URL') - .addStringOption(x=>x - .setName('server') - .setDescription('The server to update') - .setRequired(true) - .setChoices( - {name: 'Main Server', value: 'mainServer'}, - {name: 'Second Server', value: 'secondServer'} - )) - .addStringOption(x=>x - .setName('address') - .setDescription('The URL to the dedicated-server-stats.json file') - .setRequired(false))) - .addSubcommand(x=>x - .setName('info') - .setDescription('Display server information') - .addStringOption(x=>x - .setName('server') - .setDescription('The server to display information for') - .setRequired(true) - .setChoices( - {name: 'Main Server', value: 'mainServer'}, - {name: 'Second Server', value: 'secondServer'} - ))) - .addSubcommand(x=>x - .setName('maintenance') - .setDescription('Toggle maintenance mode for #mp-active-players') - .addStringOption(x=>x - .setName('message') - .setDescription('The message to display in the channel'))) + .setName('mp') + .setDescription('Display MP status and other things') + .addSubcommand(x=>x + .setName('status') + .setDescription('Display server status') + .addStringOption(x=>x + .setName('server') + .setDescription('The server to update') + .setRequired(true) + .setChoices(serverChoices[0]))) + .addSubcommand(x=>x + .setName('players') + .setDescription('Display players on server') + .addStringOption(x=>x + .setName('server') + .setDescription('The server to display players for') + .setRequired(true) + .setChoices(serverChoices[0]))) + /* .addSubcommand(x=>x + .setName('url') + .setDescription('View or update the server URL') + .addStringOption(x=>x + .setName('server') + .setDescription('The server to update') + .setRequired(true) + .setChoices( + {name: 'Main Server', value: 'mainServer'}, + {name: 'Second Server', value: 'secondServer'} + )) + .addStringOption(x=>x + .setName('address') + .setDescription('The URL to the dedicated-server-stats.json file') + .setRequired(false))) */ + .addSubcommand(x=>x + .setName('info') + .setDescription('Display server information') + .addStringOption(x=>x + .setName('server') + .setDescription('The server to display information for') + .setRequired(true) + .setChoices(serverChoices[0]))) + .addSubcommand(x=>x + .setName('maintenance') + .setDescription('Toggle maintenance mode for #mp-active-players') + .addStringOption(x=>x + .setName('message') + .setDescription('The message to display in the channel'))) }