refactor(telegram): share allowFrom normalization

This commit is contained in:
Peter Steinberger
2026-02-15 18:17:05 +00:00
parent dce3e4bd94
commit 7773c5410b
3 changed files with 19 additions and 24 deletions

View File

@@ -0,0 +1,11 @@
export function normalizeTelegramAllowFromEntry(raw: unknown): string {
const base = typeof raw === "string" ? raw : typeof raw === "number" ? String(raw) : "";
return base
.trim()
.replace(/^(telegram|tg):/i, "")
.trim();
}
export function isNumericTelegramUserId(raw: string): boolean {
return /^\d+$/.test(raw);
}