UNPKG

telegram-bot-api-wrapper

Version:

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

19 lines 643 B
import fetchWrapper from "../utils/fetchWrapper"; import urlBuilder from "../utils/urlBuilder"; export default async function sendKeyboard( token: string, chatId: number, text: string, keyboard: [], ): Promise<void> { const url = urlBuilder("https://api.telegram.org/bot", token, "sendMessage"); fetchWrapper(url, { chat_id: chatId, text: text ?? "Please choose an option:", reply_markup: { keyboard: keyboard.map(o => [o]), resize_keyboard: true, one_time_keyboard: true, }, }); }