Co-authored-by: domfelipe <53182096+domfelipe@users.noreply.github.com>
This commit is contained in:
gpt-engineer-app[bot] 2026-04-17 20:00:56 +00:00
parent 75397543e8
commit bebe095d6e
4 changed files with 188 additions and 2 deletions

View file

@ -0,0 +1,25 @@
"use client";
/**
* Sanitiza um primeiro nome para uso em sugestões de username do Telegram.
* - remove acentos via NFD
* - remove caracteres não-alfanuméricos
* - lowercase
*/
export function sanitizeForUsername(name: string): string {
return (name || "")
.normalize("NFD")
.replace(/[\u0300-\u036f]/g, "")
.replace(/[^a-zA-Z0-9]/g, "")
.toLowerCase();
}
export function suggestBotName(fullName: string | null | undefined): string {
const first = (fullName || "").trim().split(/\s+/)[0] || "Você";
return `Mika de ${first}`;
}
export function suggestBotUsername(fullName: string | null | undefined): string {
const first = sanitizeForUsername((fullName || "").trim().split(/\s+/)[0] || "voce");
return `mika_${first || "voce"}_bot`;
}