UNPKG

telegram-bot-api-wrapper

Version:

A simple wrapper for the Telegram Bot API. Just provide your bot token and start using it.

10 lines 447 B
import urlBuilder from "../utils/urlBuilder"; import fetchWrapper from "../utils/fetchWrapper"; export default function sendMessage(token: string, chatId: number, text: string): void { const url = urlBuilder("https://api.telegram.org/bot", token, "sendMessage"); try { fetchWrapper(url, { chat_id: chatId, text: text }); } catch (error) { console.error("Error sending message:", error); } }