feat: /stats to getTankStatsOverTime

This commit is contained in:
TresAbhi committed 2023-05-29 18:15:03 +00:00
1 parent 513bea6f09
commit fcf7d99012
2 files changed
+48 -104

No files matched your search

@@ -1,25 +0,0 @@
import { CacheType, ChatInputCommandInteraction } from 'discord.js';
import { PlayerPeriodicStatsCollection } from '../../types/statistics.js';
import { notTrackedByBlitzStars } from '../interaction/notTrackedByBlitzStars.js';
export default async function getBlitzStarsAccount(
interaction: ChatInputCommandInteraction<CacheType>,
accountId: number,
) {
try {
const response = await fetch(
`https://www.blitzstars.com/api/top/player/${accountId}`,
);
const parsed = (await response.json()) as PlayerPeriodicStatsCollection;
if (parsed.statistics) {
return parsed;
} else throw new Error('No data to display');
} catch (error) {
await interaction.editReply({
embeds: [notTrackedByBlitzStars],
});
throw new Error(`${accountId} not tracked by BlitzStars.`);
}
}