mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 20:19:49 +02:00
feat: clans eligibility
This commit is contained in:
1 parent
0fbc0bf07f
commit
543ae0635a
9 files changed
+254
-85
No files matched your search
@@ -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),
|
||||
],
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user