From eb4cb1fbfee7ac6b431ade3af404ee6895bb3eaf Mon Sep 17 00:00:00 2001 From: tresabhi Date: Thu, 24 Aug 2023 00:08:08 +0000 Subject: [PATCH] feat: removed inDevelopment --- src/commands/debug.ts | 1 - src/commands/eligible.ts | 1 - src/commands/evolution.tsx | 1 - src/commands/fullStats.tsx | 1 - src/commands/help.ts | 1 - src/commands/inactive.tsx | 1 - src/commands/ownedTanks.tsx | 1 - src/commands/ping.ts | 1 - src/commands/playerAchievements.ts | 1 - src/commands/playerInfo.ts | 1 - src/commands/ratings.tsx | 1 - src/commands/searchClans.ts | 1 - src/commands/searchPlayers.ts | 1 - src/commands/searchTanks.ts | 1 - src/commands/stats.tsx | 1 - src/commands/today.tsx | 1 - src/commands/verify.ts | 1 - src/events/interactionCreate/index.ts | 13 +++++-------- src/routes/stats.tsx | 1 - src/routes/today.tsx | 1 - src/server.ts | 3 --- 21 files changed, 5 insertions(+), 30 deletions(-) diff --git a/src/commands/debug.ts b/src/commands/debug.ts index 238f42962..e3afbe119 100644 --- a/src/commands/debug.ts +++ b/src/commands/debug.ts @@ -12,7 +12,6 @@ const executionStart = new Date().getTime(); export const debugCommand: CommandRegistry = { inProduction: true, - inDevelopment: true, inPublic: true, command: new SlashCommandBuilder() diff --git a/src/commands/eligible.ts b/src/commands/eligible.ts index eadb83c0b..619f31af4 100644 --- a/src/commands/eligible.ts +++ b/src/commands/eligible.ts @@ -26,7 +26,6 @@ export const SKILLED_CLANS: Record = { export const eligibleCommand: CommandRegistry = { inProduction: true, - inDevelopment: true, inPublic: false, command: new SlashCommandBuilder() diff --git a/src/commands/evolution.tsx b/src/commands/evolution.tsx index 31c4db287..2bab316f7 100644 --- a/src/commands/evolution.tsx +++ b/src/commands/evolution.tsx @@ -29,7 +29,6 @@ export const evolutionCommand = new Promise( resolve({ inProduction: true, - inDevelopment: true, inPublic: true, command, diff --git a/src/commands/fullStats.tsx b/src/commands/fullStats.tsx index 37fcc658e..bbfef0c27 100644 --- a/src/commands/fullStats.tsx +++ b/src/commands/fullStats.tsx @@ -29,7 +29,6 @@ export const fullStatsCommand = new Promise( resolve({ inProduction: true, - inDevelopment: true, inPublic: true, command, diff --git a/src/commands/help.ts b/src/commands/help.ts index a85d83319..fab71fe7e 100644 --- a/src/commands/help.ts +++ b/src/commands/help.ts @@ -30,7 +30,6 @@ function addDocsSubcommands(option: SlashCommandSubcommandsOnlyBuilder) { export const helpCommand: CommandRegistry = { inProduction: true, - inDevelopment: true, inPublic: true, command: addDocsSubcommands( diff --git a/src/commands/inactive.tsx b/src/commands/inactive.tsx index 6d2ccb712..a003cd75e 100644 --- a/src/commands/inactive.tsx +++ b/src/commands/inactive.tsx @@ -16,7 +16,6 @@ const DEFAULT_THRESHOLD = 7; export const inactiveCommand: CommandRegistry = { inProduction: true, - inDevelopment: true, inPublic: true, command: new SlashCommandBuilder() diff --git a/src/commands/ownedTanks.tsx b/src/commands/ownedTanks.tsx index dcbc391ab..3fbd82023 100644 --- a/src/commands/ownedTanks.tsx +++ b/src/commands/ownedTanks.tsx @@ -46,7 +46,6 @@ const COMP_TANKS = [ export const ownedTanksCommand: CommandRegistry = { inProduction: true, - inDevelopment: true, inPublic: true, command: new SlashCommandBuilder() diff --git a/src/commands/ping.ts b/src/commands/ping.ts index a9fcd5146..bb93c57dc 100644 --- a/src/commands/ping.ts +++ b/src/commands/ping.ts @@ -3,7 +3,6 @@ import { CommandRegistry } from '../events/interactionCreate'; export const pingCommand: CommandRegistry = { inProduction: true, - inDevelopment: true, inPublic: true, handlesInteraction: true, diff --git a/src/commands/playerAchievements.ts b/src/commands/playerAchievements.ts index 2a81a2d2d..e6f178238 100644 --- a/src/commands/playerAchievements.ts +++ b/src/commands/playerAchievements.ts @@ -16,7 +16,6 @@ type SortBy = 'name' | 'count'; export const playerAchievementsCommand: CommandRegistry = { inProduction: true, - inDevelopment: true, inPublic: true, command: new SlashCommandBuilder() diff --git a/src/commands/playerInfo.ts b/src/commands/playerInfo.ts index ce26234c5..c65c181cf 100644 --- a/src/commands/playerInfo.ts +++ b/src/commands/playerInfo.ts @@ -12,7 +12,6 @@ import { AccountInfo } from '../types/accountInfo'; export const playerInfoCommand: CommandRegistry = { inProduction: true, - inDevelopment: true, inPublic: true, command: new SlashCommandBuilder() diff --git a/src/commands/ratings.tsx b/src/commands/ratings.tsx index 6493edcc3..4e56a16ec 100644 --- a/src/commands/ratings.tsx +++ b/src/commands/ratings.tsx @@ -162,7 +162,6 @@ export const ratingsCommand = new Promise( resolve({ inProduction: true, - inDevelopment: true, inPublic: true, command, diff --git a/src/commands/searchClans.ts b/src/commands/searchClans.ts index a7ca4e6f8..f02e70fc4 100644 --- a/src/commands/searchClans.ts +++ b/src/commands/searchClans.ts @@ -11,7 +11,6 @@ import { ClanList } from '../types/clanList'; export const searchClansCommand: CommandRegistry = { inProduction: true, - inDevelopment: true, inPublic: true, command: new SlashCommandBuilder() diff --git a/src/commands/searchPlayers.ts b/src/commands/searchPlayers.ts index b6c62b6d2..645ba217e 100644 --- a/src/commands/searchPlayers.ts +++ b/src/commands/searchPlayers.ts @@ -12,7 +12,6 @@ import { AccountList } from '../types/accountList'; export const searchPlayersCommand: CommandRegistry = { inProduction: true, - inDevelopment: true, inPublic: true, command: new SlashCommandBuilder() diff --git a/src/commands/searchTanks.ts b/src/commands/searchTanks.ts index 20e5ff5c5..441443b92 100644 --- a/src/commands/searchTanks.ts +++ b/src/commands/searchTanks.ts @@ -8,7 +8,6 @@ import { CommandRegistry } from '../events/interactionCreate'; export const searchTanksCommand: CommandRegistry = { inProduction: true, - inDevelopment: true, inPublic: true, command: new SlashCommandBuilder() diff --git a/src/commands/stats.tsx b/src/commands/stats.tsx index 6913b08dd..f20a5da70 100644 --- a/src/commands/stats.tsx +++ b/src/commands/stats.tsx @@ -27,7 +27,6 @@ export const statsCommand = new Promise(async (resolve) => { resolve({ inProduction: true, - inDevelopment: true, inPublic: true, command, diff --git a/src/commands/today.tsx b/src/commands/today.tsx index 12cf88dd1..6c4960e9b 100644 --- a/src/commands/today.tsx +++ b/src/commands/today.tsx @@ -15,7 +15,6 @@ import { AccountInfo } from '../types/accountInfo'; export const todayCommand: CommandRegistry = { inProduction: true, - inDevelopment: true, inPublic: true, command: new SlashCommandBuilder() diff --git a/src/commands/verify.ts b/src/commands/verify.ts index c6682c1cf..560afb22a 100644 --- a/src/commands/verify.ts +++ b/src/commands/verify.ts @@ -14,7 +14,6 @@ import { PlayerClanData } from '../types/playerClanData'; export const verifyCommand: CommandRegistry = { inProduction: true, - inDevelopment: true, inPublic: true, command: new SlashCommandBuilder() diff --git a/src/events/interactionCreate/index.ts b/src/events/interactionCreate/index.ts index 6664952cc..d068efca2 100644 --- a/src/events/interactionCreate/index.ts +++ b/src/events/interactionCreate/index.ts @@ -50,7 +50,6 @@ export type InteractionReturnable = | Promise; export interface Registry { - inDevelopment: boolean; inProduction: boolean; } @@ -122,14 +121,12 @@ export const publicCommands: RESTPostAPIChatInputApplicationCommandsJSONBody[] = commands.then((awaitedCommands) => { Object.entries(awaitedCommands).forEach(([, registry]) => { - if (isDev() ? registry.inDevelopment : registry.inProduction) { - const json = registry.command.toJSON(); + const json = registry.command.toJSON(); - if (registry.inPublic) { - publicCommands.push(json); - } else { - guildCommands.push(json); - } + if (registry.inPublic) { + publicCommands.push(json); + } else { + guildCommands.push(json); } }); diff --git a/src/routes/stats.tsx b/src/routes/stats.tsx index a096d4181..8c04f2eec 100644 --- a/src/routes/stats.tsx +++ b/src/routes/stats.tsx @@ -6,7 +6,6 @@ import { RouteRegistry } from '../server'; export const statsRoute: RouteRegistry = { route: '/stats/:type/:period', inProduction: true, - inDevelopment: true, async handler(req) { const type = req.params.type as StatType; diff --git a/src/routes/today.tsx b/src/routes/today.tsx index bb66e12d7..f070df620 100644 --- a/src/routes/today.tsx +++ b/src/routes/today.tsx @@ -5,7 +5,6 @@ import { RouteRegistry } from '../server'; export const todayRoute: RouteRegistry = { route: '/today', inProduction: true, - inDevelopment: true, async handler(req) { const player = resolvePlayerFromRequest(req); diff --git a/src/server.ts b/src/server.ts index 1d249786f..6fdc3df6f 100644 --- a/src/server.ts +++ b/src/server.ts @@ -1,7 +1,6 @@ import express, { Request, Response } from 'express'; import normalizeRouteReturnable from './core/express/normalizeRouteReturnable'; import withAutoRefresh from './core/express/withAutoRefresh'; -import isDev from './core/node/isDev'; import { Registry } from './events/interactionCreate'; import { statsRoute } from './routes/stats'; import { todayRoute } from './routes/today'; @@ -22,8 +21,6 @@ export interface RouteRegistry const app = express(); ([statsRoute, todayRoute] as RouteRegistry[]).forEach((registry) => { - if (!(isDev() ? registry.inDevelopment : registry.inProduction)) return; - app.get(registry.route, async (req, res) => { console.log(req.originalUrl);