mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-25 19:49:50 +01:00
fix: time zone compliant commands
This commit is contained in:
1 parent
dd0644e09f
commit
405f544774
11 files changed
+54
-30
No files matched your search
@@ -1,9 +1,11 @@
|
||||
import { ButtonInteraction, CacheType } from 'discord.js';
|
||||
import { CYCLIC_API } from '../../constants/cyclic.js';
|
||||
import { BlitzServer } from '../../constants/servers.js';
|
||||
import resolvePeriodFromURL from '../express/resolvePeriodFromURL.js';
|
||||
|
||||
export default function resolvePeriodFromButton(
|
||||
server: BlitzServer,
|
||||
interaction: ButtonInteraction<CacheType>,
|
||||
) {
|
||||
return resolvePeriodFromURL(`${CYCLIC_API}/${interaction.customId}`);
|
||||
return resolvePeriodFromURL(server, `${CYCLIC_API}/${interaction.customId}`);
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { CacheType, ChatInputCommandInteraction } from 'discord.js';
|
||||
import { BlitzServer } from '../../constants/servers.js';
|
||||
import getPeriodNow from '../blitzstars/getPeriodNow.js';
|
||||
import getPeriodStart from '../blitzstars/getPeriodStart.js';
|
||||
import getTimeDaysAgo from '../blitzstars/getTimeDaysAgo.js';
|
||||
@@ -30,6 +31,7 @@ export interface ResolvedPeriod {
|
||||
}
|
||||
|
||||
export default function resolvePeriodFromCommand(
|
||||
server: BlitzServer,
|
||||
interaction: ChatInputCommandInteraction<CacheType>,
|
||||
) {
|
||||
let statsName: string;
|
||||
@@ -46,12 +48,12 @@ export default function resolvePeriodFromCommand(
|
||||
|
||||
statsName = `${startMin} to ${endMax} days' statistics`;
|
||||
evolutionName = `${startMin} to ${endMax} days' evolution`;
|
||||
start = getTimeDaysAgo(startMin);
|
||||
end = getTimeDaysAgo(endMax);
|
||||
start = getTimeDaysAgo(server, startMin);
|
||||
end = getTimeDaysAgo(server, endMax);
|
||||
} else {
|
||||
statsName = PERIOD_NAMES[period];
|
||||
evolutionName = EVOLUTION_PERIOD_NAMES[period];
|
||||
start = getPeriodStart(period);
|
||||
start = getPeriodStart(server, period);
|
||||
end = getPeriodNow();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user