feat: clans eligibility

This commit is contained in:
TresAbhi committed 2023-04-22 19:32:49 +00:00
1 parent 0fbc0bf07f
commit 543ae0635a
9 files changed
+254 -85

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
import {
CacheType,
ChatInputCommandInteraction,
EmbedBuilder,
} from 'discord.js';
import { NEGATIVE_COLOR } from '../constants/colors.js';
import { PlayerStatistics } from '../types/statistics.js';
export default async function getBlitzStarsAccount(
interaction: ChatInputCommandInteraction<CacheType>,
accountId: number,
ign: string,
callback: (account: PlayerStatistics) => void,
) {
fetch(`https://www.blitzstars.com/api/top/player/${accountId}`)
.then(async (response) => {
callback((await response.json()) as PlayerStatistics);
})
.catch(() => {
interaction.reply({
embeds: [
new EmbedBuilder()
.setTitle('No data to display')
.setDescription(`${ign} is not tracked by BlitzStars.`)
.setColor(NEGATIVE_COLOR),
],
});
});
}