From c986a94204258929779d9d92743868b5ecf82d3e Mon Sep 17 00:00:00 2001 From: Nicholas Bottone Date: Sun, 9 Jun 2024 19:28:29 -0400 Subject: [PATCH] Fix number env variable and crescendo result embed --- src/config/env.ts | 2 +- src/lib/resultEmbed/index.ts | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/config/env.ts b/src/config/env.ts index f980377..a8ada3a 100644 --- a/src/config/env.ts +++ b/src/config/env.ts @@ -13,7 +13,7 @@ const envSchema = z.object({ DISCORD_CHANNEL_ID: z.string().min(1), DISCORD_CATEGORY_ID: z.string().min(1), GAME_NAME: z.enum(["CHARGED UP", "CRESCENDO"]), - TEAMS_PER_ALLIANCE: z.number().int(), + TEAMS_PER_ALLIANCE: z.string().transform(Number), }); envSchema.parse(process.env); diff --git a/src/lib/resultEmbed/index.ts b/src/lib/resultEmbed/index.ts index 9a3c44b..1f98852 100644 --- a/src/lib/resultEmbed/index.ts +++ b/src/lib/resultEmbed/index.ts @@ -3,6 +3,11 @@ import { sendQualMatchEmbed as chargedUpSendQualMatchEmbed, sendPlayoffMatchEmbed as chargedUpSendPlayoffMatchEmbed, } from "./chargedUp"; +import { + sendQualMatchEmbed as crescendoSendQualMatchEmbed, + sendPlayoffMatchEmbed as crescendoSendPlayoffMatchEmbed, +} from "./crescendo"; + import type { Match } from "../match"; let gameSendQualMatchEmbed: (guild: Guild, match: never) => void; @@ -10,10 +15,14 @@ let gameSendPlayoffMatchEmbed: (guild: Guild, match: never) => void; switch (process.env.GAME_NAME) { case "CHARGED UP": - default: gameSendQualMatchEmbed = chargedUpSendQualMatchEmbed; gameSendPlayoffMatchEmbed = chargedUpSendPlayoffMatchEmbed; break; + case "CRESCENDO": + default: + gameSendQualMatchEmbed = crescendoSendQualMatchEmbed; + gameSendPlayoffMatchEmbed = crescendoSendPlayoffMatchEmbed; + break; } export const sendQualMatchEmbed = (guild: Guild, match: Match) => {