mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: cleaned blitz
This commit is contained in:
1 parent
9dc48c9125
commit
c7821d03d2
15 files changed
+36
-68
No files matched your search
@@ -1,18 +1,14 @@
|
||||
import { CacheType, ChatInputCommandInteraction } from 'discord.js';
|
||||
import { BlitzServer } from '../../constants/servers.js';
|
||||
import { serverAndIdPattern } from '../discord/resolvePlayerFromCommand.js';
|
||||
import errorWithCause from '../node/errorWithCause.js';
|
||||
import listClansPanServer from './listClansPanServer.js';
|
||||
import listClans from './listClans.js';
|
||||
|
||||
export default async function getBlitzClan(
|
||||
interaction: ChatInputCommandInteraction<CacheType>,
|
||||
clan: string,
|
||||
) {
|
||||
export default async function getBlitzClan(clan: string) {
|
||||
if (serverAndIdPattern.test(clan)) {
|
||||
const [server, accountId] = clan.split('/');
|
||||
return { server: server as BlitzServer, id: Number(accountId) };
|
||||
} else {
|
||||
const accounts = await listClansPanServer(clan);
|
||||
const accounts = await listClans(clan);
|
||||
|
||||
if (accounts[0]) {
|
||||
return { server: accounts[0].server, id: accounts[0].clan_id };
|
||||
|
||||
Reference in new issue
Block a user