Skip to main content
The Deno 2 Release Candidate is here
Learn more
Latest
class TelegramBot
extends TelegramApi
import { TelegramBot } from "https://deno.land/x/telegram_bot_api@0.4.0/src/telegram-bot/telegram-bot.ts";

Constructors

new
TelegramBot(token: string)
new
TelegramBot(params: BotInitParams)
new
TelegramBot(params: string | BotInitParams)

Properties

private
params: BotParams
private
readonly
updatesEventTarget: EventTarget
private
optional
updatesStrategy: UpdatesStrategy

Methods

private
handleUpdates(updates: Update[])
protected
multipartRequest<T extends Method>(methodName: string, formData: FormData): ReturnType<T>
protected
request<T extends Method>(methodName: string, params?: Parameters<T>[0]): ReturnType<T>

Handles update object from Telegram

on(eventType: UpdateType.Error, callback: (error: UpdateError) => void): void
on(eventType: UpdateType.Message, callback: (update: MessageUpdate) => void): void
on(eventType: UpdateType.EditedMessage, callback: (update: EditedMessageUpdate) => void): void
on(eventType: UpdateType.ChannelPost, callback: (update: ChannelPostUpdate) => void): void
on(eventType: UpdateType.EditedChannelPost, callback: (update: EditedChannelPostUpdate) => void): void
on(eventType: UpdateType.InlineQuery, callback: (update: InlineQueryUpdate) => void): void
on(eventType: UpdateType.ChosenInlineResult, callback: (update: ChosenInlineResultUpdate) => void): void
on(eventType: UpdateType.CallbackQuery, callback: (update: CallbackQueryUpdate) => void): void
on(eventType: UpdateType.ShippingQuery, callback: (update: ShippingQueryUpdate) => void): void
on(eventType: UpdateType.PreCheckoutQuery, callback: (update: PreCheckoutQueryUpdate) => void): void
on(eventType: UpdateType.Poll, callback: (update: PollUpdate) => void): void
on(eventType: UpdateType.PollAnswer, callback: (update: PollAnswerUpdate) => void): void
run(params: RunWithPollingParams): void
run(params: RunWithWebhookParams): void