mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 18:57:03 +02:00
feat: extracted evolution renderer
This commit is contained in:
1 parent
752f9b339b
commit
d8a78bc25e
4 files changed
+166
-152
No files matched your search
@@ -88,5 +88,5 @@ export default async function getPlayerHistories(
|
||||
}
|
||||
}
|
||||
|
||||
return [...previousNodes, ...filtered, ...latestNodes] satisfies Histories;
|
||||
return [...latestNodes, ...filtered, ...previousNodes] satisfies Histories;
|
||||
}
|
||||
@@ -2,7 +2,7 @@ import { CacheType, ChatInputCommandInteraction } from 'discord.js';
|
||||
import getPeriodNow from '../blitzstars/getPeriodNow.js';
|
||||
import getPeriodStart from '../blitzstars/getPeriodStart.js';
|
||||
import getTimeDaysAgo from '../blitzstars/getTimeDaysAgo.js';
|
||||
import { Period } from './addPeriodSubCommands.js';
|
||||
import { Period, RELATIVE_PERIOD_NAMES } from './addPeriodSubCommands.js';
|
||||
|
||||
export const PERIOD_NAMES: Record<Period, string> = {
|
||||
today: "Today's statistics",
|
||||
@@ -23,6 +23,7 @@ export const EVOLUTION_PERIOD_NAMES: Record<Period, string> = {
|
||||
};
|
||||
|
||||
export interface ResolvedPeriod {
|
||||
relativePeriodName: string;
|
||||
statsName: string;
|
||||
evolutionName: string;
|
||||
start: number;
|
||||
@@ -37,6 +38,8 @@ export default function resolvePeriod(
|
||||
let evolutionName: string;
|
||||
let start: number;
|
||||
let end: number;
|
||||
const relativePeriodName =
|
||||
RELATIVE_PERIOD_NAMES[interaction.options.getSubcommand() as Period];
|
||||
|
||||
if (period === 'custom') {
|
||||
const startRaw = interaction.options.getInteger('start')!;
|
||||
@@ -55,5 +58,11 @@ export default function resolvePeriod(
|
||||
end = getPeriodNow();
|
||||
}
|
||||
|
||||
return { statsName, evolutionName, start, end } satisfies ResolvedPeriod;
|
||||
return {
|
||||
statsName,
|
||||
evolutionName,
|
||||
start,
|
||||
end,
|
||||
relativePeriodName,
|
||||
} satisfies ResolvedPeriod;
|
||||
}
|
||||
Reference in new issue
Block a user