From b7cad061bd8e635390fb00ed8d68ccf85597610b Mon Sep 17 00:00:00 2001 From: AnxietyisReal <96593068+AnxietyisReal@users.noreply.github.com> Date: Wed, 27 Dec 2023 09:17:24 +1100 Subject: [PATCH] Move statsGraph to mp file --- src/client.ts | 1 - src/commands/mp.ts | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/client.ts b/src/client.ts index 1bb5917..52e1137 100644 --- a/src/client.ts +++ b/src/client.ts @@ -41,7 +41,6 @@ export default class TClient extends Discord.Client { public tags: TagSystemSvc = new TagSystemSvc(); public ytChannels: YouTubeChannelsSvc = new YouTubeChannelsSvc(); public repeatedMessages: IRepeatedMessages = {}; - public statsGraph: number = -120; constructor() { super({ diff --git a/src/commands/mp.ts b/src/commands/mp.ts index f3f94a5..403d61e 100644 --- a/src/commands/mp.ts +++ b/src/commands/mp.ts @@ -20,7 +20,6 @@ const channels = { activePlayers: '739084625862852715', announcements: '1084864116776251463', mainMpChat: '468835769092669461', - mfMpChat: '1149238561934151690', serverInfo: '543494084363288637', } export default class MP { @@ -32,7 +31,7 @@ export default class MP { static async run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>) { if (client.config.botSwitches.mpSys === false) return interaction.reply({embeds: [mpModuleDisabled(client)]}); if (client.uptime < refreshTimerSecs) return interaction.reply('MPModule isn\'t initialized yet, please wait a moment and try again.'); - if ([channels.mainMpChat, channels.mfMpChat].includes(interaction.channelId) && !MessageTool.isStaff(interaction.member) && ['status', 'players'].includes(interaction.options.getSubcommand())) return interaction.reply(`Please use <#${channels.activePlayers}> for \`/mp status/players\` commands to prevent clutter in this channel.`).then(()=>setTimeout(()=>interaction.deleteReply(), 6000)); + if ([channels.mainMpChat, client.config.dcServer.channels.multifarm_chat].includes(interaction.channelId) && !MessageTool.isStaff(interaction.member) && ['status', 'players'].includes(interaction.options.getSubcommand())) return interaction.reply(`Please use <#${channels.activePlayers}> for \`/mp status/players\` commands to prevent clutter in this channel.`).then(()=>setTimeout(()=>interaction.deleteReply(), 6000)); const choiceSelector = interaction.options.getString('server'); ({ players: async()=>{ @@ -40,7 +39,7 @@ export default class MP { if (!DSS) return console.log('Endpoint failed - players'); const PDArr = await client.MPServer.fetchPlayerData(choiceSelector); - const canvas = await new CanvasBuilder().generateGraph(PDArr.slice(client.statsGraph), 'players'); + const canvas = await new CanvasBuilder().generateGraph(PDArr.slice(-120), 'players'); const players:string[] = []; let embedColor:Discord.ColorResolvable; switch (true){