mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 04:51:25 +00:00
refactor(telegram): share allowFrom normalization
This commit is contained in:
11
src/channels/telegram/allow-from.ts
Normal file
11
src/channels/telegram/allow-from.ts
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user