mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 02:37:05 +02:00
feat: type cleanup
This commit is contained in:
1 parent
9f12f82485
commit
0e37d0479a
3 files changed
+20
-11
No files matched your search
@@ -5,6 +5,7 @@ import {
|
||||
SlashCommandBuilder,
|
||||
} from 'discord.js';
|
||||
import config from '../../config.json' assert { type: 'json' };
|
||||
import AccountList from '../types/accountList.js';
|
||||
|
||||
const SERVER_NAMES = { com: 'North America', eu: 'Europe', asia: 'Asia' };
|
||||
|
||||
@@ -16,11 +17,7 @@ export async function execute(
|
||||
const serverName = SERVER_NAMES[server as keyof typeof SERVER_NAMES];
|
||||
const players = (await fetch(
|
||||
`https://api.wotblitz.${server}/wotb/account/list/?application_id=${config.wargaming_application_id}&search=${ign}`,
|
||||
).then((response) => response.json())) as
|
||||
| {
|
||||
data: { nickname: string; account_id: number }[] | undefined;
|
||||
}
|
||||
| undefined;
|
||||
).then((response) => response.json())) as AccountList;
|
||||
|
||||
if (players?.data?.[0].nickname === ign) {
|
||||
// good match
|
||||
|
||||
+11
-6
@@ -8,6 +8,7 @@ import {
|
||||
REST,
|
||||
Routes,
|
||||
SlashCommandBuilder,
|
||||
TextChannel,
|
||||
} from 'discord.js';
|
||||
import { readdirSync } from 'fs';
|
||||
import config from '../config.json' assert { type: 'json' };
|
||||
@@ -24,8 +25,11 @@ client.on('ready', (c) => {
|
||||
client.on('guildMemberAdd', async (member) => {
|
||||
console.log(`${member.user.tag} joined`);
|
||||
|
||||
//@ts-ignore
|
||||
await member.guild.channels.cache.get(config.discord_verify_channel)?.send({
|
||||
await (
|
||||
member.guild.channels.cache.get(
|
||||
config.discord_verify_channel,
|
||||
) as TextChannel
|
||||
).send({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setColor('#8e3cf5')
|
||||
@@ -39,10 +43,11 @@ client.on('guildMemberAdd', async (member) => {
|
||||
),
|
||||
],
|
||||
});
|
||||
await member.guild.channels.cache
|
||||
.get(config.discord_verify_channel)
|
||||
//@ts-ignore
|
||||
?.send(member.toString());
|
||||
await (
|
||||
member.guild.channels.cache.get(
|
||||
config.discord_verify_channel,
|
||||
) as TextChannel
|
||||
).send(member.toString());
|
||||
});
|
||||
|
||||
export interface CommandRegistry {
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
type AccountList =
|
||||
| {
|
||||
data?: { nickname: string; account_id: number }[];
|
||||
}
|
||||
| undefined;
|
||||
|
||||
export default AccountList;
|
||||
Reference in new issue
Block a user