/** * Build a Telegram Bot API method URL for the given bot token. */ export function telegramApiUrl(botToken: string, method: string): string { return `https://api.telegram.org/bot${botToken}/${method}` } export function convertMarkdownToHTML(text: string): string { return ( text // Bold: **text** or __text__ -> text .replace(/\*\*(.*?)\*\*/g, '$1') .replace(/__(.*?)__/g, '$1') // Italic: *text* or _text_ -> text .replace(/\*(.*?)\*/g, '$1') .replace(/_(.*?)_/g, '$1') // Code: `text` -> text .replace(/`(.*?)`/g, '$1') // Links: [text](url) -> text .replace(/\[([^\]]+)\]\(([^)]+)\)/g, '$1') ) }