mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-10 11:16:10 +01:00
24 lines
659 B
TypeScript
24 lines
659 B
TypeScript
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,
|
|
) {
|
|
const { strings } = translator(locale);
|
|
const trimmed = search.trim();
|
|
|
|
if (trimmed.length < 3) {
|
|
throw new UserError(strings.bot.common.errors.query_too_small);
|
|
}
|
|
|
|
if (trimmed.length > 100) {
|
|
throw new UserError(strings.bot.common.errors.query_too_long);
|
|
}
|
|
|
|
return await searchClansAcrossRegions(trimmed, limit);
|
|
}
|