Skip to content

Commit

Permalink
Fix number env variable and crescendo result embed
Browse files Browse the repository at this point in the history
  • Loading branch information
NicholasBottone committed Jun 9, 2024
1 parent d1afdc4 commit c986a94
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/config/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
11 changes: 10 additions & 1 deletion src/lib/resultEmbed/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,26 @@ 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;
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) => {
Expand Down

0 comments on commit c986a94

Please sign in to comment.