diff --git a/apps/api/src/player/player.controller.ts b/apps/api/src/player/player.controller.ts index 9dbd4c86a..1d47e9524 100644 --- a/apps/api/src/player/player.controller.ts +++ b/apps/api/src/player/player.controller.ts @@ -20,10 +20,8 @@ import { DeletePlayerResponse, ErrorResponse, GetPlayerResponse, - GetRecentGamesResponse, GetStatusResponse, PlayerNotFoundException, - RecentGamesNotFoundException, StatusNotFoundException, } from "@statsify/api-client"; @@ -78,22 +76,6 @@ export class PlayerController { }; } - @ApiOperation({ summary: "Get the Recent Games of a Player" }) - @ApiOkResponse({ type: GetRecentGamesResponse }) - @ApiBadRequestResponse({ type: ErrorResponse }) - @ApiNotFoundResponse({ type: RecentGamesNotFoundException }) - @ApiNotFoundResponse({ type: PlayerNotFoundException }) - @Auth() - @Get("/recentgames") - public async getRecentGames(@Query() { player: tag }: PlayerDto) { - const recentGames = await this.playerService.getRecentGames(tag); - - return { - success: !!recentGames, - recentGames, - }; - } - @ApiOperation({ summary: "Get the Status of a Player" }) @ApiOkResponse({ type: GetStatusResponse }) @ApiBadRequestResponse({ type: ErrorResponse }) diff --git a/apps/api/src/player/player.service.ts b/apps/api/src/player/player.service.ts index 2bc4bf96e..d2ee45b35 100644 --- a/apps/api/src/player/player.service.ts +++ b/apps/api/src/player/player.service.ts @@ -9,8 +9,6 @@ import { type APIData, type Circular, type Flatten, flatten } from "@statsify/util"; import { CacheLevel, - PlayerNotFoundException, - RecentGamesNotFoundException, StatusNotFoundException, } from "@statsify/api-client"; import { HypixelService } from "#hypixel"; @@ -115,7 +113,10 @@ export class PlayerService { if (!player) throw new NotFoundException("player"); - const status = await this.hypixelService.getStatus(player.uuid); + const [status, games] = await Promise.all([ + this.hypixelService.getStatus(player.uuid), + this.hypixelService.getRecentGames(player.uuid), + ]); if (!status) throw new StatusNotFoundException(player); @@ -123,31 +124,11 @@ export class PlayerService { status.prefixName = player.prefixName; status.uuid = player.uuid; status.actions = player.status; + status.recentGames = games; return status; } - public async getRecentGames(tag: string) { - const player = await this.get(tag, CacheLevel.CACHE_ONLY, { - uuid: true, - displayName: true, - prefixName: true, - }); - - if (!player) throw new PlayerNotFoundException(); - - const games = await this.hypixelService.getRecentGames(player.uuid); - - if (!games || !games.length) throw new RecentGamesNotFoundException(player); - - return { - uuid: player.uuid, - displayName: player.displayName, - prefixName: player.prefixName, - games, - }; - } - /** * * @param tag UUID or Username of the player diff --git a/apps/discord-bot/src/commands/arcade/arcade.profile.tsx b/apps/discord-bot/src/commands/arcade/arcade.profile.tsx index b0c19e2e2..976db99ef 100644 --- a/apps/discord-bot/src/commands/arcade/arcade.profile.tsx +++ b/apps/discord-bot/src/commands/arcade/arcade.profile.tsx @@ -76,7 +76,7 @@ export const ArcadeProfile = ({ break; case "dropper": - table = ; + table = ; break; case "enderSpleef": @@ -112,7 +112,7 @@ export const ArcadeProfile = ({ break; case "partyGames": - table = ; + table = ; break; case "pixelPainters": @@ -149,7 +149,7 @@ export const ArcadeProfile = ({ sidebar={sidebar} title={`§l${FormattedGame.ARCADE} §f${ api === "overall" ? t("stats.wins") : "Stats" - } §r(${mode.formatted})`} + } §r(${mode.formatted}${mode.submode ? ` ${mode.submode.formatted}` : ""})`} time={time} /> {table} diff --git a/apps/discord-bot/src/commands/arcade/dropper.command.tsx b/apps/discord-bot/src/commands/arcade/dropper.command.tsx deleted file mode 100644 index 4b53c2890..000000000 --- a/apps/discord-bot/src/commands/arcade/dropper.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 { - BaseHypixelCommand, - BaseProfileProps, - ProfileData, -} from "#commands/base.hypixel-command"; -import { Command } from "@statsify/discord"; -import { DROPPER_MODES, DropperModes } from "@statsify/schemas"; -import { DropperProfile } from "./dropper.profile.js"; - -@Command({ description: (t) => t("commands.dropper") }) -export class DropperCommand extends BaseHypixelCommand { - public constructor() { - super(DROPPER_MODES); - } - - public getProfile( - base: BaseProfileProps, - { mode }: ProfileData - ): JSX.Element { - return ; - } -} diff --git a/apps/discord-bot/src/commands/arcade/dropper.profile.tsx b/apps/discord-bot/src/commands/arcade/dropper.profile.tsx deleted file mode 100644 index d15a9ddb3..000000000 --- a/apps/discord-bot/src/commands/arcade/dropper.profile.tsx +++ /dev/null @@ -1,66 +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 - */ - -/** - * 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 { Container, Footer, Header } from "#components"; -import { DropperMapsTable, DropperTable } from "./modes/index.js"; -import { DropperModes, FormattedGame, type GameMode } from "@statsify/schemas"; -import type { BaseProfileProps } from "#commands/base.hypixel-command"; - -export interface DropperProfileProps extends BaseProfileProps { - mode: GameMode; -} - -export const DropperProfile = ({ - skin, - player, - background, - logo, - user, - badge, - mode, - t, - time, -}: DropperProfileProps) => { - const { arcade } = player.stats; - - let table; - - switch (mode.api) { - case "overall": - table = ; - break; - case "bestTimes": - table = ; - break; - case "completions": - table = ; - break; - } - - return ( - -
- {table} -