Files
blitzkit/packages/bot/src/core/blitz/searchClansAcrossRegionsBotWrapper.ts
T

23 lines
659 B
TypeScript
Raw Normal View History

2024-12-14 13:27:45 -06:00
import { searchClansAcrossRegions } from '@blitzkit/core';
import { Locale } from 'discord.js';
import { UserError } from '../blitzkit/userError';
import { translator } from '../localization/translator';
export async function searchClansAcrossRegionsBotWrapper(
search: string,
locale: Locale,
limit?: number,
) {
2025-01-16 13:53:29 -06:00
const { strings } = translator(locale);
2024-12-14 13:27:45 -06:00
const trimmed = search.trim();
if (trimmed.length < 3) {
2025-01-16 13:53:29 -06:00
throw new UserError(strings.bot.common.errors.query_too_small);
2024-12-14 13:27:45 -06:00
}
if (trimmed.length > 100) {
2025-01-16 13:53:29 -06:00
throw new UserError(strings.bot.common.errors.query_too_long);
2024-12-14 13:27:45 -06:00
}
return await searchClansAcrossRegions(trimmed, limit);
}