mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: player clan data typings
This commit is contained in:
1 parent
ab88be7c94
commit
3cd52b2688
8 files changed
+31
-18
No files matched your search
@@ -8,10 +8,9 @@ import fetch from 'node-fetch';
|
||||
import discord from '../../discord.json' assert { type: 'json' };
|
||||
import { NEGATIVE_COLOR, POSITIVE_COLOR } from '../constants/colors.js';
|
||||
import { SERVERS } from '../constants/servers.js';
|
||||
import { PlayerClanData } from '../types/playerClanData.js';
|
||||
import getBlitzAccount from '../utilities/getBlitzAccount.js';
|
||||
|
||||
export const inDev = true;
|
||||
|
||||
export async function execute(
|
||||
interaction: ChatInputCommandInteraction<CacheType>,
|
||||
) {
|
||||
@@ -24,11 +23,9 @@ export async function execute(
|
||||
// good match
|
||||
const clanData = (await fetch(
|
||||
`https://api.wotblitz.${server}/wotb/clans/accountinfo/?application_id=${process.env.WARGAMING_APPLICATION_ID}&account_id=${account.account_id}&extra=clan`,
|
||||
).then((response) => response.json())) as {
|
||||
data: { [key: number]: { clan: { tag: string } | null } };
|
||||
};
|
||||
).then((response) => response.json())) as PlayerClanData;
|
||||
const clan = clanData.data[account.account_id].clan;
|
||||
const clanTag = clan === null ? '' : ` [${clan.tag}]`;
|
||||
const clanTag = clan === null ? '' : ` [${clan!.tag}]`;
|
||||
|
||||
if (interaction.member && interaction.guild) {
|
||||
const member = interaction.guild?.members.cache.get(
|
||||
|
||||
Reference in new issue
Block a user