Options
All
  • Public
  • Public/Protected
  • All
Menu

Type parameters

  • U: Deunionize<tg.Update> = tg.Update

Hierarchy

Index

Constructors

constructor

  • new Context<U>(update: U, tg: Telegram, botInfo: UserFromGetMe): Context<U>
  • Type parameters

    • U: (CallbackQueryUpdate & AddOptionalKeys<"message" | "channel_post" | "chat_member" | "chosen_inline_result" | "edited_channel_post" | "edited_message" | "inline_query" | "my_chat_member" | "pre_checkout_query" | "poll_answer" | "poll" | "shipping_query">) | (ChannelPostUpdate & AddOptionalKeys<"callback_query" | "message" | "chat_member" | "chosen_inline_result" | "edited_channel_post" | "edited_message" | "inline_query" | "my_chat_member" | "pre_checkout_query" | "poll_answer" | "poll" | "shipping_query">) | (ChatMemberUpdate & AddOptionalKeys<"callback_query" | "message" | "channel_post" | "chosen_inline_result" | "edited_channel_post" | "edited_message" | "inline_query" | "my_chat_member" | "pre_checkout_query" | "poll_answer" | "poll" | "shipping_query">) | (ChosenInlineResultUpdate & AddOptionalKeys<"callback_query" | "message" | "channel_post" | "chat_member" | "edited_channel_post" | "edited_message" | "inline_query" | "my_chat_member" | "pre_checkout_query" | "poll_answer" | "poll" | "shipping_query">) | (EditedChannelPostUpdate & AddOptionalKeys<"callback_query" | "message" | "channel_post" | "chat_member" | "chosen_inline_result" | "edited_message" | "inline_query" | "my_chat_member" | "pre_checkout_query" | "poll_answer" | "poll" | "shipping_query">) | (EditedMessageUpdate & AddOptionalKeys<"callback_query" | "message" | "channel_post" | "chat_member" | "chosen_inline_result" | "edited_channel_post" | "inline_query" | "my_chat_member" | "pre_checkout_query" | "poll_answer" | "poll" | "shipping_query">) | (InlineQueryUpdate & AddOptionalKeys<"callback_query" | "message" | "channel_post" | "chat_member" | "chosen_inline_result" | "edited_channel_post" | "edited_message" | "my_chat_member" | "pre_checkout_query" | "poll_answer" | "poll" | "shipping_query">) | (MessageUpdate & AddOptionalKeys<"callback_query" | "channel_post" | "chat_member" | "chosen_inline_result" | "edited_channel_post" | "edited_message" | "inline_query" | "my_chat_member" | "pre_checkout_query" | "poll_answer" | "poll" | "shipping_query">) | (MyChatMemberUpdate & AddOptionalKeys<"callback_query" | "message" | "channel_post" | "chat_member" | "chosen_inline_result" | "edited_channel_post" | "edited_message" | "inline_query" | "pre_checkout_query" | "poll_answer" | "poll" | "shipping_query">) | (PreCheckoutQueryUpdate & AddOptionalKeys<"callback_query" | "message" | "channel_post" | "chat_member" | "chosen_inline_result" | "edited_channel_post" | "edited_message" | "inline_query" | "my_chat_member" | "poll_answer" | "poll" | "shipping_query">) | (PollAnswerUpdate & AddOptionalKeys<"callback_query" | "message" | "channel_post" | "chat_member" | "chosen_inline_result" | "edited_channel_post" | "edited_message" | "inline_query" | "my_chat_member" | "pre_checkout_query" | "poll" | "shipping_query">) | (PollUpdate & AddOptionalKeys<"callback_query" | "message" | "channel_post" | "chat_member" | "chosen_inline_result" | "edited_channel_post" | "edited_message" | "inline_query" | "my_chat_member" | "pre_checkout_query" | "poll_answer" | "shipping_query">) | (ShippingQueryUpdate & AddOptionalKeys<"callback_query" | "message" | "channel_post" | "chat_member" | "chosen_inline_result" | "edited_channel_post" | "edited_message" | "inline_query" | "my_chat_member" | "pre_checkout_query" | "poll_answer" | "poll">) = Update

    Parameters

    • update: U
    • tg: Telegram
    • botInfo: UserFromGetMe

    Returns Context<U>

Properties

Readonly botInfo

botInfo: UserFromGetMe

Readonly state

state: Record<string | symbol, any> = {}

Readonly tg

Readonly update

update: U

Accessors

callbackQuery

  • get callbackQuery(): PropOr<U, "callback_query", undefined>
  • Returns PropOr<U, "callback_query", undefined>

channelPost

  • get channelPost(): PropOr<U, "channel_post", undefined>
  • Returns PropOr<U, "channel_post", undefined>

chat

  • get chat(): PropOr<GetUpdateContent<U>, "chat", undefined>
  • Returns PropOr<GetUpdateContent<U>, "chat", undefined>

chatMember

  • get chatMember(): PropOr<U, "chat_member", undefined>
  • Returns PropOr<U, "chat_member", undefined>

chosenInlineResult

  • get chosenInlineResult(): PropOr<U, "chosen_inline_result", undefined>
  • Returns PropOr<U, "chosen_inline_result", undefined>

editedChannelPost

  • get editedChannelPost(): PropOr<U, "edited_channel_post", undefined>
  • Returns PropOr<U, "edited_channel_post", undefined>

editedMessage

  • get editedMessage(): PropOr<U, "edited_message", undefined>
  • Returns PropOr<U, "edited_message", undefined>

from

  • get from(): PropOr<GetUpdateContent<U>, "from", undefined>
  • Returns PropOr<GetUpdateContent<U>, "from", undefined>

inlineMessageId

  • get inlineMessageId(): undefined | string

inlineQuery

  • get inlineQuery(): PropOr<U, "inline_query", undefined>
  • Returns PropOr<U, "inline_query", undefined>

me

  • get me(): string

message

  • get message(): PropOr<U, "message", undefined>

myChatMember

  • get myChatMember(): PropOr<U, "my_chat_member", undefined>
  • Returns PropOr<U, "my_chat_member", undefined>

passportData

  • get passportData(): undefined | PassportData

poll

  • get poll(): PropOr<U, "poll", undefined>

pollAnswer

  • get pollAnswer(): PropOr<U, "poll_answer", undefined>
  • Returns PropOr<U, "poll_answer", undefined>

preCheckoutQuery

  • get preCheckoutQuery(): PropOr<U, "pre_checkout_query", undefined>
  • Returns PropOr<U, "pre_checkout_query", undefined>

senderChat

  • get senderChat(): PropOr<GetUpdateContent<U>, "sender_chat", undefined>
  • Returns PropOr<GetUpdateContent<U>, "sender_chat", undefined>

shippingQuery

  • get shippingQuery(): PropOr<U, "shipping_query", undefined>
  • Returns PropOr<U, "shipping_query", undefined>

telegram

updateType

  • get updateType(): Extract<UnionKeys<U>, UpdateType>

webhookReply

  • get webhookReply(): boolean
  • set webhookReply(enable: boolean): void

Methods

addStickerToSet

answerCbQuery

answerGameQuery

  • answerGameQuery(...args: [url: string]): Promise<true>

answerInlineQuery

  • answerInlineQuery(...args: [results: readonly InlineQueryResult[], extra?: ExtraAnswerInlineQuery]): Promise<true>

answerPreCheckoutQuery

  • answerPreCheckoutQuery(...args: [ok: boolean, errorMessage?: string]): Promise<true>

answerShippingQuery

  • answerShippingQuery(...args: [ok: boolean, shippingOptions: readonly ShippingOption[], errorMessage: string]): Promise<true>

Private assert

  • assert<T>(value: undefined | T, method: string): asserts value is T
  • Type parameters

    • T: string | object

    Parameters

    • value: undefined | T
    • method: string

    Returns asserts value is T

copyMessage

  • copyMessage(chatId: string | number, extra?: ExtraCopyMessage): Promise<MessageId>

createChatInviteLink

createNewStickerSet

deleteChatPhoto

  • deleteChatPhoto(...args: []): Promise<true>

deleteChatStickerSet

  • deleteChatStickerSet(): Promise<true>

deleteMessage

  • deleteMessage(messageId?: number): Promise<true>

deleteStickerFromSet

  • deleteStickerFromSet(sticker: string): Promise<true>

editChatInviteLink

editMessageCaption

  • editMessageCaption(caption: undefined | string, extra?: ExtraEditMessageCaption): Promise<true | (Edited & CaptionableMessage)>

editMessageLiveLocation

  • editMessageLiveLocation(latitude: number, longitude: number, extra?: ExtraEditMessageLiveLocation): Promise<true | (Edited & LocationMessage)>

editMessageMedia

  • editMessageMedia(media: {} | {} | {} | {} | {}, extra?: ExtraEditMessageMedia): Promise<true | (Edited & AnimationMessage) | (Edited & AudioMessage) | (Edited & DocumentMessage) | (Edited & PhotoMessage) | (Edited & VideoMessage)>

editMessageReplyMarkup

  • editMessageReplyMarkup(markup: undefined | InlineKeyboardMarkup): Promise<true | ((Edited & LocationMessage) & (Edited & TextMessage) & (Edited & AnimationMessage) & (Edited & AudioMessage) & (Edited & DocumentMessage) & (Edited & PhotoMessage) & (Edited & VideoMessage) & (Edited & ChannelChatCreatedMessage) & (Edited & ConnectedWebsiteMessage) & (Edited & DeleteChatPhotoMessage) & (Edited & GroupChatCreatedMessage) & (Edited & InvoiceMessage) & (Edited & LeftChatMemberMessage) & (Edited & MessageAutoDeleteTimerChangedMessage) & (Edited & MigrateFromChatIdMessage) & (Edited & MigrateToChatIdMessage) & (Edited & NewChatMembersMessage) & (Edited & NewChatPhotoMessage) & (Edited & NewChatTitleMessage) & (Edited & PassportDataMessage) & (Edited & ProximityAlertTriggeredMessage) & (Edited & PinnedMessageMessage) & (Edited & SuccessfulPaymentMessage) & (Edited & SupergroupChatCreated) & (Edited & VoiceChatScheduledMessage) & (Edited & VoiceChatStartedMessage) & (Edited & VoiceChatEndedMessage) & (Edited & VoiceChatParticipantsInvitedMessage) & (Edited & ContactMessage) & (Edited & DiceMessage) & (Edited & GameMessage) & (Edited & PollMessage) & (Edited & StickerMessage) & (Edited & VenueMessage) & (Edited & VideoNoteMessage) & (Edited & VoiceMessage))>
  • Parameters

    • markup: undefined | InlineKeyboardMarkup

    Returns Promise<true | ((Edited & LocationMessage) & (Edited & TextMessage) & (Edited & AnimationMessage) & (Edited & AudioMessage) & (Edited & DocumentMessage) & (Edited & PhotoMessage) & (Edited & VideoMessage) & (Edited & ChannelChatCreatedMessage) & (Edited & ConnectedWebsiteMessage) & (Edited & DeleteChatPhotoMessage) & (Edited & GroupChatCreatedMessage) & (Edited & InvoiceMessage) & (Edited & LeftChatMemberMessage) & (Edited & MessageAutoDeleteTimerChangedMessage) & (Edited & MigrateFromChatIdMessage) & (Edited & MigrateToChatIdMessage) & (Edited & NewChatMembersMessage) & (Edited & NewChatPhotoMessage) & (Edited & NewChatTitleMessage) & (Edited & PassportDataMessage) & (Edited & ProximityAlertTriggeredMessage) & (Edited & PinnedMessageMessage) & (Edited & SuccessfulPaymentMessage) & (Edited & SupergroupChatCreated) & (Edited & VoiceChatScheduledMessage) & (Edited & VoiceChatStartedMessage) & (Edited & VoiceChatEndedMessage) & (Edited & VoiceChatParticipantsInvitedMessage) & (Edited & ContactMessage) & (Edited & DiceMessage) & (Edited & GameMessage) & (Edited & PollMessage) & (Edited & StickerMessage) & (Edited & VenueMessage) & (Edited & VideoNoteMessage) & (Edited & VoiceMessage))>

editMessageText

exportChatInviteLink

  • exportChatInviteLink(...args: []): Promise<string>

forwardMessage

  • forwardMessage(chatId: string | number, extra?: { disable_notification?: boolean }): Promise<Message>

getChat

  • getChat(...args: []): Promise<ChatFromGetChat>

getChatAdministrators

  • getChatAdministrators(...args: []): Promise<ChatMember[]>

getChatMember

  • getChatMember(...args: [userId: number]): Promise<ChatMember>

getChatMembersCount

  • getChatMembersCount(...args: []): Promise<number>

getMyCommands

  • getMyCommands(): Promise<BotCommand[]>

getStickerSet

  • getStickerSet(setName: string): Promise<StickerSet>

kickChatMember

  • kickChatMember(...args: [userId: number, untilDate?: number, extra?: ExtraKickChatMember]): Promise<true>

leaveChat

  • leaveChat(...args: []): Promise<true>

pinChatMessage

  • pinChatMessage(...args: [messageId: number, extra?: { disable_notification?: boolean }]): Promise<true>

promoteChatMember

reply

replyWithAnimation

  • replyWithAnimation(...args: [animation: string | InputFile, extra?: ExtraAnimation]): Promise<AnimationMessage>

replyWithAudio

  • replyWithAudio(...args: [audio: string | InputFile, extra?: ExtraAudio]): Promise<AudioMessage>

replyWithChatAction

  • replyWithChatAction(...args: [action: "typing" | "upload_photo" | "record_video" | "upload_video" | "record_voice" | "upload_voice" | "upload_document" | "find_location" | "record_video_note" | "upload_video_note"]): Promise<true>

replyWithContact

  • replyWithContact(...args: [phoneNumber: string, firstName: string, extra?: ExtraContact]): Promise<ContactMessage>

replyWithDice

  • replyWithDice(...args: [extra?: ExtraDice]): Promise<DiceMessage>

replyWithDocument

  • replyWithDocument(...args: [document: string | InputFile, extra?: ExtraDocument]): Promise<DocumentMessage>

replyWithGame

  • replyWithGame(...args: [gameName: string, extra?: ExtraGame]): Promise<GameMessage>

replyWithHTML

replyWithInvoice

replyWithLocation

  • replyWithLocation(...args: [latitude: number, longitude: number, extra?: ExtraLocation]): Promise<LocationMessage>

replyWithMarkdown

replyWithMarkdownV2

  • replyWithMarkdownV2(markdown: string, extra?: ExtraReplyMessage): Promise<TextMessage>

replyWithMediaGroup

  • replyWithMediaGroup(...args: [media: readonly ({} | {})[] | readonly {}[] | readonly {}[], extra?: ExtraMediaGroup]): Promise<(DocumentMessage | AudioMessage | PhotoMessage | VideoMessage)[]>

replyWithPhoto

  • replyWithPhoto(...args: [photo: string | InputFile, extra?: ExtraPhoto]): Promise<PhotoMessage>

replyWithPoll

  • replyWithPoll(...args: [question: string, options: readonly string[], extra?: ExtraPoll]): Promise<PollMessage>

replyWithQuiz

  • replyWithQuiz(...args: [question: string, options: readonly string[], extra: ExtraPoll]): Promise<PollMessage>

replyWithSticker

  • replyWithSticker(...args: [sticker: string | InputFile, extra?: ExtraSticker]): Promise<StickerMessage>

replyWithVenue

  • replyWithVenue(...args: [latitude: number, longitude: number, title: string, address: string, extra?: ExtraVenue]): Promise<VenueMessage>

replyWithVideo

  • replyWithVideo(...args: [video: string | InputFile, extra?: ExtraVideo]): Promise<VideoMessage>

replyWithVideoNote

  • replyWithVideoNote(...args: [videoNote: string | InputFileVideoNote, extra?: ExtraVideoNote]): Promise<VideoNoteMessage>

replyWithVoice

  • replyWithVoice(...args: [voice: string | InputFile, extra?: ExtraVoice]): Promise<VoiceMessage>

restrictChatMember

revokeChatInviteLink

  • revokeChatInviteLink(...args: [inviteLink: string]): Promise<ChatInviteLink>

setChatAdministratorCustomTitle

  • setChatAdministratorCustomTitle(...args: [userId: number, title: string]): Promise<true>

setChatDescription

  • setChatDescription(...args: [description?: string]): Promise<true>

setChatPermissions

  • setChatPermissions(...args: [permissions: ChatPermissions]): Promise<true>

setChatPhoto

  • setChatPhoto(...args: [photo: InputFile]): Promise<true>

setChatStickerSet

  • setChatStickerSet(setName: string): Promise<true>

setChatTitle

  • setChatTitle(...args: [title: string]): Promise<true>

setMyCommands

  • setMyCommands(commands: readonly BotCommand[]): Promise<true>

setPassportDataErrors

  • setPassportDataErrors(errors: readonly PassportElementError[]): Promise<true>

setStickerPositionInSet

  • setStickerPositionInSet(sticker: string, position: number): Promise<true>

setStickerSetThumb

  • setStickerSetThumb(...args: [name: string, userId: number, thumb: string | InputFile]): Promise<true>

stopMessageLiveLocation

  • stopMessageLiveLocation(markup?: InlineKeyboardMarkup): Promise<true | (Edited & LocationMessage)>

stopPoll

  • stopPoll(...args: [messageId: number, extra?: ExtraStopPoll]): Promise<Poll>

unbanChatMember

  • unbanChatMember(...args: [userId: number, extra?: { only_if_banned?: boolean }]): Promise<true>

unpinAllChatMessages

  • unpinAllChatMessages(...args: []): Promise<true>

unpinChatMessage

  • unpinChatMessage(...args: [messageId?: number]): Promise<true>

uploadStickerFile

  • uploadStickerFile(...args: [stickerFile: InputFile]): Promise<File>

Generated using TypeDoc