mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: cleaned discord
This commit is contained in:
1 parent
169588a211
commit
01ed20941d
30 files changed
+93
-121
No files matched your search
@@ -0,0 +1,29 @@
|
||||
import {
|
||||
ApplicationCommandOptionChoiceData,
|
||||
AutocompleteInteraction,
|
||||
CacheType,
|
||||
} from 'discord.js';
|
||||
import { BLITZ_SERVERS } from '../../constants/servers.js';
|
||||
import listClans from '../blitz/listClans.js';
|
||||
|
||||
export default async function autocompleteClan(
|
||||
interaction: AutocompleteInteraction<CacheType>,
|
||||
) {
|
||||
const focusedOption = interaction.options.getFocused(true);
|
||||
if (focusedOption.name !== 'clan') return;
|
||||
const players = await listClans(focusedOption.value);
|
||||
|
||||
await interaction.respond(
|
||||
players
|
||||
? players.map(
|
||||
(player) =>
|
||||
({
|
||||
name: `${player.name} (${BLITZ_SERVERS[player.server]})`,
|
||||
value: `${player.server}/${player.clan_id}`,
|
||||
} satisfies ApplicationCommandOptionChoiceData<string>),
|
||||
)
|
||||
: [],
|
||||
);
|
||||
|
||||
console.log(`Clan autocomplete for ${focusedOption.value}`);
|
||||
}
|
||||
Reference in new issue
Block a user