Class Context<U>

Type Parameters

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

Hierarchy

Constructors

Properties

Accessors

Methods

addStickerToSet answerCbQuery answerGameQuery answerInlineQuery answerPreCheckoutQuery answerShippingQuery approveChatJoinRequest banChatMember banChatSenderChat closeForumTopic closeGeneralForumTopic copyMessage copyMessages createChatInviteLink createForumTopic createNewStickerSet declineChatJoinRequest deleteChatPhoto deleteChatStickerSet deleteForumTopic deleteMessage deleteMessages deleteStickerFromSet deleteStickerSet editChatInviteLink editForumTopic editGeneralForumTopic editMessageCaption editMessageLiveLocation editMessageMedia editMessageReplyMarkup editMessageText entities exportChatInviteLink forwardMessage forwardMessages getChat getChatAdministrators getChatMember getChatMembersCount getChatMenuButton getMyCommands getMyDefaultAdministratorRights getStickerSet getUserChatBoosts has hideGeneralForumTopic leaveChat persistentChatAction pinChatMessage promoteChatMember react reopenForumTopic reopenGeneralForumTopic reply replyWithAnimation replyWithAudio replyWithChatAction replyWithContact replyWithDice replyWithDocument replyWithGame replyWithHTML replyWithInvoice replyWithLocation replyWithMarkdown replyWithMarkdownV2 replyWithMediaGroup replyWithPhoto replyWithPoll replyWithQuiz replyWithSticker replyWithVenue replyWithVideo replyWithVideoNote replyWithVoice restrictChatMember revokeChatInviteLink sendAnimation sendAudio sendChatAction sendContact sendDice sendDocument sendGame sendInvoice sendLocation sendMediaGroup sendMessage sendPhoto sendPoll sendQuiz sendSticker sendVenue sendVideo sendVideoNote sendVoice setChatAdministratorCustomTitle setChatDescription setChatMenuButton setChatPermissions setChatPhoto setChatStickerSet setChatTitle setCustomEmojiStickerSetThumbnail setMyCommands setMyDefaultAdministratorRights setPassportDataErrors setStickerEmojiList setStickerKeywords setStickerMaskPosition setStickerPositionInSet setStickerSetThumb setStickerSetThumbnail setStickerSetTitle stopMessageLiveLocation stopPoll unbanChatMember unbanChatSenderChat unhideGeneralForumTopic unpinAllChatMessages unpinAllForumTopicMessages unpinAllGeneralForumTopicMessages unpinChatMessage uploadStickerFile

Constructors

  • Type Parameters

    • U extends Deunionize<Update> = Update

    Parameters

    • update: U
    • telegram: Telegram
    • botInfo: UserFromGetMe

    Returns Context<U>

Properties

botInfo: UserFromGetMe
state: Record<string | symbol, any> = {}
telegram: Telegram
update: U

Accessors

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

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

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

  • get chatBoost(): PropOr<U, "chat_boost">
  • Returns PropOr<U, "chat_boost">

  • get chatJoinRequest(): PropOr<U, "chat_join_request">
  • Returns PropOr<U, "chat_join_request">

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

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

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

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

  • get from(): GetUserFromAnySource<U>
  • Returns GetUserFromAnySource<U>

  • get inlineMessageId(): undefined | string
  • Returns undefined | string

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

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

  • get messageReaction(): PropOr<U, "message_reaction">
  • Returns PropOr<U, "message_reaction">

  • get messageReactionCount(): PropOr<U, "message_reaction_count">
  • Returns PropOr<U, "message_reaction_count">

  • get msg(): GetMsg<U> & Msg
  • Shorthand for any message object present in the current update. One of message, edited_message, channel_post, edited_channel_post or callback_query.message

    Returns GetMsg<U> & Msg

  • get msgId(): GetMsgId<U>
  • Shorthand for any message_id present in the current update.

    Returns GetMsgId<U>

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

  • get passportData(): undefined | PassportData
  • Returns undefined | PassportData

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

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

  • get removedChatBoost(): PropOr<U, "removed_chat_boost">
  • Returns PropOr<U, "removed_chat_boost">

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

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

  • get webAppData(): undefined | {
        button_text: string;
        data: {
            json<T>() => T;
            text() => string;
        };
    }
  • Returns undefined | {
        button_text: string;
        data: {
            json<T>() => T;
            text() => string;
        };
    }

Methods

  • Use this method to close an open topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success.

    Returns Promise<true>

  • Context-aware shorthand for Telegram.copyMessages

    Parameters

    • chatId: string | number

      Unique identifier for the target chat or username of the target channel (in the format @channelusername)

    • messageIds: number[]

      Identifiers of 1-100 messages in the chat from_chat_id to copy. The identifiers must be specified in a strictly increasing order.

    • Optional extra: Omit<{}, "chat_id" | "from_chat_id" | "message_ids">
      Optional

    Returns Promise<MessageId[]>

  • Use this method to create a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns information about the created topic as a ForumTopic object.

    Parameters

    • Rest ...args: [name: string, extra?: Omit<{}, "chat_id" | "name">]
      Rest

    Returns Promise<ForumTopic>

  • Use this method to delete a forum topic along with all its messages in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_delete_messages administrator rights. Returns True on success.

    Returns Promise<true>

  • Context-aware shorthand for Telegram.deleteMessages

    Parameters

    • messageIds: number[]

      Identifiers of 1-100 messages to delete. See deleteMessage for limitations on which messages can be deleted

    Returns Promise<true>

  • Parameters

    • Rest ...args: [name: string]
      Rest

    Returns Promise<true>

  • Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success.

    Parameters

    • extra: Omit<{}, "chat_id" | "message_thread_id">

    Returns Promise<true>

  • Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have can_manage_topics administrator rights. Returns True on success.

    Parameters

    • name: string

    Returns Promise<true>

  • Parameters

    • latitude: number
    • longitude: number
    • Optional extra: Omit<{}, "chat_id" | "message_id" | "inline_message_id" | "latitude" | "longitude">
      Optional

    Returns Promise<true | Edited & LocationMessage>

  • Type Parameters

    • EntityTypes extends ("mention" | "hashtag" | "cashtag" | "bot_command" | "url" | "email" | "phone_number" | "bold" | "blockquote" | "italic" | "underline" | "strikethrough" | "spoiler" | "code" | "custom_emoji" | "pre" | "text_link" | "text_mention")[]

    Parameters

    • Rest ...types: EntityTypes
      Rest

    Returns Object[]

  • Type Parameters

    Parameters

    • filters: MaybeArray<Filter>

    Returns this is FilteredContext<Context<Update>, Filter>

  • Use this method to hide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically closed if it was open. Returns True on success.

    Returns Promise<true>

  • Parameters

    • action: "typing" | "upload_photo" | "record_video" | "upload_video" | "record_voice" | "upload_voice" | "upload_document" | "choose_sticker" | "find_location" | "record_video_note" | "upload_video_note"

      chat action type.

    • callback: (() => Promise<void>)

      a function to run along with the chat action.

        • (): Promise<void>
        • Returns Promise<void>

    • extra: Omit<{}, "action" | "chat_id"> & {
          intervalDuration?: number;
      } = {}

      extra parameters for sendChatAction.

    Returns Promise<void>

    See

    https://core.telegram.org/bots/api#sendchataction

    Sends the sendChatAction request repeatedly, with a delay between requests, as long as the provided callback function is being processed.

    The sendChatAction errors should be ignored, because the goal is the actual long process completing and performing an action.

  • Parameters

    • Optional reaction: MaybeArray<ReactionType | TelegramEmoji | `0${string}` | `1${string}` | `2${string}` | `3${string}` | `4${string}` | `5${string}` | `6${string}` | `7${string}` | `8${string}` | `9${string}`>

      An emoji or custom_emoji_id to set as reaction to current message. Leave empty to remove reactions.

      Optional
    • Optional is_big: boolean

      Pass True to set the reaction with a big animation

      Optional

    Returns Promise<true>

  • Use this method to reopen a closed topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success.

    Returns Promise<true>

  • Use this method to reopen a closed 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically unhidden if it was hidden. Returns True on success.

    Returns Promise<true>

  • Parameters

    • Rest ...args: [action: "typing" | "upload_photo" | "record_video" | "upload_video" | "record_voice" | "upload_voice" | "upload_document" | "choose_sticker" | "find_location" | "record_video_note" | "upload_video_note", extra?: Omit<{}, "action" | "chat_id">]
      Rest

    Returns Promise<true>

  • Parameters

    • Rest ...args: [invoice: Omit<{}, "chat_id" | "message_thread_id" | "disable_notification" | "reply_parameters" | "reply_markup">, extra?: Omit<{}, "chat_id" | "protect_content" | "title" | "description" | "payload" | "provider_token" | "currency" | "prices" | "max_tip_amount" | "suggested_tip_amounts" | "provider_data" | "photo_url" | "photo_size" | "photo_width" | "photo_height" | "need_name" | "need_phone_number" | "need_email" | "need_shipping_address" | "send_phone_number_to_provider" | "send_email_to_provider" | "is_flexible" | "start_parameter">]
      Rest

    Returns Promise<InvoiceMessage>

  • Parameters

    • Rest ...args: [latitude: number, longitude: number, title: string, address: string, extra?: Omit<{}, "chat_id" | "title" | "latitude" | "longitude" | "address">]
      Rest

    Returns Promise<VenueMessage>

  • Parameters

    • action: "typing" | "upload_photo" | "record_video" | "upload_video" | "record_voice" | "upload_voice" | "upload_document" | "choose_sticker" | "find_location" | "record_video_note" | "upload_video_note"
    • Optional extra: Omit<{}, "action" | "chat_id">
      Optional

    Returns Promise<true>

  • Parameters

    • invoice: Omit<{}, "chat_id" | "message_thread_id" | "disable_notification" | "reply_parameters" | "reply_markup">
    • Optional extra: Omit<{}, "chat_id" | "protect_content" | "title" | "description" | "payload" | "provider_token" | "currency" | "prices" | "max_tip_amount" | "suggested_tip_amounts" | "provider_data" | "photo_url" | "photo_size" | "photo_width" | "photo_height" | "need_name" | "need_phone_number" | "need_email" | "need_shipping_address" | "send_phone_number_to_provider" | "send_email_to_provider" | "is_flexible" | "start_parameter">
      Optional

    Returns Promise<InvoiceMessage>

  • Parameters

    • latitude: number
    • longitude: number
    • title: string
    • address: string
    • Optional extra: Omit<{}, "chat_id" | "title" | "latitude" | "longitude" | "address">
      Optional

    Returns Promise<VenueMessage>

  • Parameters

    • Rest ...args: [name: string, custom_emoji_id: string]
      Rest

    Returns Promise<true>

  • Parameters

    • Rest ...args: [sticker: string, emoji_list: string[]]
      Rest

    Returns Promise<true>

  • Parameters

    • Rest ...args: [sticker: string, keywords?: string[]]
      Rest

    Returns Promise<true>

  • Parameters

    • Rest ...args: [sticker: string, mask_position?: MaskPosition]
      Rest

    Returns Promise<true>

  • Parameters

    • Rest ...args: [name: string, userId: number, thumbnail?: string | InputFile]
      Rest

    Returns Promise<true>

  • Parameters

    • Rest ...args: [name: string, title: string]
      Rest

    Returns Promise<true>

Generated using TypeDoc