diff --git a/apps/discord-bot/package.json b/apps/discord-bot/package.json index d364e4a0d..9b5f35e7c 100644 --- a/apps/discord-bot/package.json +++ b/apps/discord-bot/package.json @@ -41,7 +41,10 @@ "default": "./dist/components/index.js" }, "#commands/*": { - "types": "./src/commands/*.ts", + "types": [ + "./src/commands/*.ts", + "./src/commands/*.tsx" + ], "default": "./dist/commands/*.js" }, "#services": { diff --git a/apps/discord-bot/src/commands/bedwars/bedwars-challenges.command.tsx b/apps/discord-bot/src/commands/bedwars/bedwars-challenges.command.tsx deleted file mode 100644 index b7323b175..000000000 --- a/apps/discord-bot/src/commands/bedwars/bedwars-challenges.command.tsx +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (c) Statsify - * - * This source code is licensed under the GNU GPL v3 license found in the - * LICENSE file in the root directory of this source tree. - * https://github.com/Statsify/statsify/blob/main/LICENSE - */ - -import { BEDWARS_MODES, BedWarsModes, GameModeWithSubModes, Player } from "@statsify/schemas"; -import { BaseHypixelCommand, BaseProfileProps } from "#commands/base.hypixel-command"; -import { BedWarsChallengesProfile } from "./bedwars-challenges.profile.js"; -import { Command } from "@statsify/discord"; - -@Command({ description: (t) => t("commands.bedwars-challenges") }) -export class BedWarsChallengesCommand extends BaseHypixelCommand { - public constructor() { - super(BEDWARS_MODES); - } - - public filterModes( - player: Player, - modes: GameModeWithSubModes[] - ): GameModeWithSubModes[] { - return [modes[0]]; - } - - public getProfile(base: BaseProfileProps): JSX.Element { - return ; - } -} diff --git a/apps/discord-bot/src/commands/bedwars/bedwars.command.tsx b/apps/discord-bot/src/commands/bedwars/bedwars.command.tsx index e404439ae..a19fa57e1 100644 --- a/apps/discord-bot/src/commands/bedwars/bedwars.command.tsx +++ b/apps/discord-bot/src/commands/bedwars/bedwars.command.tsx @@ -12,6 +12,7 @@ import { BaseProfileProps, ProfileData, } from "#commands/base.hypixel-command"; +import { BedWarsChallengesProfile } from "./bedwars-challenges.profile.js"; import { BedWarsProfile } from "./bedwars.profile.js"; import { Command } from "@statsify/discord"; @@ -25,6 +26,7 @@ export class BedWarsCommand extends BaseHypixelCommand { base: BaseProfileProps, { mode }: ProfileData ): JSX.Element { + if (mode.api === "overall" && mode.submode.api === "challenges") return ; return ; } } diff --git a/apps/discord-bot/src/commands/deprecated/bedwars-challenges.command.tsx b/apps/discord-bot/src/commands/deprecated/bedwars-challenges.command.tsx new file mode 100644 index 000000000..7067d2617 --- /dev/null +++ b/apps/discord-bot/src/commands/deprecated/bedwars-challenges.command.tsx @@ -0,0 +1,23 @@ +/** + * Copyright (c) Statsify + * + * This source code is licensed under the GNU GPL v3 license found in the + * LICENSE file in the root directory of this source tree. + * https://github.com/Statsify/statsify/blob/main/LICENSE + */ + +import { Command, type IMessage } from "@statsify/discord"; + +@Command({ description: (t) => t("deprecated.command-description", { newCommandName: "/bedwars" }) }) +export class BedWarsChallengesCommand { + public run(): IMessage { + return { + content: (t) => t("deprecated.merged-dropdown", { + oldCommandName: "`/bedwarschallenges`", + newCommand: "", + newCommandName: `${t("emojis:games.BEDWARS")} **BedWars**`, + mode: "**Challenges**", + }), + }; + } +} diff --git a/apps/discord-bot/src/commands/deprecated/skywars-challenges.command.tsx b/apps/discord-bot/src/commands/deprecated/skywars-challenges.command.tsx new file mode 100644 index 000000000..d2a73f0fc --- /dev/null +++ b/apps/discord-bot/src/commands/deprecated/skywars-challenges.command.tsx @@ -0,0 +1,23 @@ +/** + * Copyright (c) Statsify + * + * This source code is licensed under the GNU GPL v3 license found in the + * LICENSE file in the root directory of this source tree. + * https://github.com/Statsify/statsify/blob/main/LICENSE + */ + +import { Command, type IMessage } from "@statsify/discord"; + +@Command({ description: (t) => t("deprecated.command-description", { newCommandName: "/skywars" }) }) +export class SkyWarsChallengesCommand { + public run(): IMessage { + return { + content: (t) => t("deprecated.merged-dropdown", { + oldCommandName: "`/skywarschallenges`", + newCommand: "", + newCommandName: `${t("emojis:games.SKYWARS")} **SkyWars**`, + mode: "**Challenges**", + }), + }; + } +} diff --git a/apps/discord-bot/src/commands/duels/tables/titles.table.tsx b/apps/discord-bot/src/commands/duels/duels-titles.profile.tsx similarity index 58% rename from apps/discord-bot/src/commands/duels/tables/titles.table.tsx rename to apps/discord-bot/src/commands/duels/duels-titles.profile.tsx index fa0bbc314..5d248a5c7 100644 --- a/apps/discord-bot/src/commands/duels/tables/titles.table.tsx +++ b/apps/discord-bot/src/commands/duels/duels-titles.profile.tsx @@ -6,32 +6,31 @@ * https://github.com/Statsify/statsify/blob/main/LICENSE */ +import { Container, Footer, Header } from "#components"; +import { FormattedGame } from "@statsify/schemas"; + +import { Image } from "skia-canvas"; +import { LocalizeFunction } from "@statsify/discord"; import { arrayGroup } from "@statsify/util"; -import type { Duels } from "@statsify/schemas"; -import type { DuelsModeIcons } from "../duels.command.js"; -import type { Image } from "skia-canvas"; -import type { LocalizeFunction } from "@statsify/discord"; +import type { BaseProfileProps } from "#commands/base.hypixel-command"; +import type { DuelsModeIcons } from "./duels.command.js"; -interface TitlesTableProps { - duels: Duels; - t: LocalizeFunction; +export interface DuelsTitlesProfileProps extends Omit { modeIcons: DuelsModeIcons; } -function ModeTitle({ icon, title, wins, t }: { icon: Image; title: string;wins: number;t: LocalizeFunction }) { - return ( - - - - {title} - -
- {t(wins)} - - ); -} +export const DuelsTitlesProfile = ({ + skin, + player, + background, + logo, + user, + badge, + t, + modeIcons, +}: DuelsTitlesProfileProps) => { + const { duels } = player.stats; -export const TitlesTable = ({ duels, t, modeIcons }: TitlesTableProps) => { const games = [ { icon: modeIcons.blitzsg, title: duels.blitzsg.titleFormatted, wins: duels.blitzsg.wins }, { icon: modeIcons.bow, title: duels.bow.titleFormatted, wins: duels.bow.wins }, @@ -53,27 +52,51 @@ export const TitlesTable = ({ duels, t, modeIcons }: TitlesTableProps) => { const groups = arrayGroup(games, games.length / 2); return ( -
- +
-
- {groups.map((group) => ( -
- {group.map(({ icon, title, wins }) => ( - - ))} -
- ))} +
+ +
+ {groups.map((group) => ( +
+ {group.map(({ icon, title, wins }) => ( + + ))} +
+ ))} +
-
+