ultra-telegram-framework
    Preparing search index...

    Interface SceneContext

    interface SceneContext {
        api: TelegramBotApi;
        callbackQuery?: CallbackQuery;
        menu?: InlineMenuManager<any>;
        message?: MaybeInaccessibleMessage;
        scene: SceneManager;
        session: SessionData;
        update: Update;
        get channel(): ChannelContext;
        get chatId(): number | undefined;
        get from(): User | undefined;
        get game(): GameContext;
        get group(): GroupContext;
        get isMessageAccessible(): boolean;
        get payload(): string;
        get senderId(): number | undefined;
        get text(): string | undefined;
        answerCallbackQuery(
            params?: string | Omit<AnswerCallbackQueryParams, "callback_query_id">,
        ): Promise<boolean>;
        answerGuest(
            result: InlineQueryResult,
            options?: Omit<AnswerGuestQueryParams, "guest_query_id" | "result">,
        ): Promise<SentGuestMessage>;
        answerPreCheckoutQuery(
            ok: boolean,
            errorMessage?: string,
        ): Promise<boolean>;
        answerShippingQuery(
            ok: boolean,
            options?: Omit<AnswerShippingQueryParams, "shipping_query_id" | "ok">,
        ): Promise<boolean>;
        copyTo(toChatId: string | number): Promise<MessageId>;
        deleteAllReactions(
            options?: Omit<DeleteAllMessageReactionsParams, "chat_id">,
        ): Promise<boolean>;
        deleteMessage(): Promise<boolean>;
        deleteReaction(
            options?: Omit<DeleteMessageReactionParams, "chat_id" | "message_id">,
        ): Promise<boolean>;
        editCaption(
            caption: string,
            options?: Omit<
                EditMessageCaptionParams,
                "caption"
                | "chat_id"
                | "message_id",
            >,
        ): Promise<boolean | Message>;
        editMessageText(
            content:
                | string
                | (
                    ({ html: string; markdown?: undefined; } | { markdown: string; html?: undefined; }) & Pick<InputRichMessage, "is_rtl" | "skip_entity_detection">
                ),
            options?: Omit<
                EditMessageTextParams,
                "text"
                | "chat_id"
                | "message_id"
                | "rich_message",
            >,
        ): Promise<boolean | Message>;
        editReplyMarkup(
            replyMarkup?: InlineKeyboardMarkup,
            messageId?: number,
        ): Promise<boolean | Message>;
        forwardTo(toChatId: string | number): Promise<Message>;
        getAdministrators(): Promise<ChatMember[]>;
        getGameHighScores(): Promise<GameHighScore[]>;
        getMember(userId: number): Promise<ChatMember>;
        getRequiredIds(operation: string): { chatId: number; messageId: number };
        getRequiredIds(
            operation: string,
            force: true,
        ): { chatId: number; messageId: number };
        getRequiredIds(
            operation: string,
            force: false,
        ): { chatId: number; messageId: number | undefined };
        leaveChat(): Promise<boolean>;
        react(reactions: ReactionType[]): Promise<boolean>;
        reply(
            text: string,
            options?: Omit<SendMessageParams, "text" | "chat_id">,
        ): Promise<Message>;
        replyWithChatAction(
            action:
                | "typing"
                | "upload_photo"
                | "record_video"
                | "upload_video"
                | "record_voice"
                | "upload_voice"
                | "upload_document"
                | "choose_sticker"
                | "find_location"
                | "record_video_note"
                | "upload_video_note",
            options?: Omit<SendChatActionParams, "chat_id" | "action">,
        ): Promise<boolean>;
        replyWithDocument(
            document: string | InputFile,
            options?: Omit<SendDocumentParams, "chat_id" | "document">,
        ): Promise<Message>;
        replyWithDraft(
            draftId: number,
            options?: Omit<SendMessageDraftParams, "chat_id" | "draft_id">,
        ): Promise<boolean>;
        replyWithGame(
            gameShortName: string,
            options?: Omit<SendGameParams, "chat_id" | "game_short_name">,
        ): Promise<Message>;
        replyWithInlineKeyboard(
            text: string,
            buttons: InlineKeyboardButton[][] | InlineKeyboard,
            options?: Omit<SendMessageParams, "text" | "chat_id" | "reply_markup">,
        ): Promise<Message>;
        replyWithInvoice(
            params: Omit<SendInvoiceParams, "chat_id">,
        ): Promise<Message>;
        replyWithKeyboard(
            text: string,
            keyboard:
                | InlineKeyboardMarkup
                | ReplyKeyboardMarkup
                | ReplyKeyboardRemove
                | ForceReply
                | InlineKeyboard
                | ReplyKeyboard,
            options?: Omit<SendMessageParams, "text" | "chat_id" | "reply_markup">,
        ): Promise<Message>;
        replyWithLivePhoto(
            photo: string | InputFile,
            livePhoto: string | InputFile,
            options?: Omit<SendLivePhotoParams, "chat_id" | "photo" | "live_photo">,
        ): Promise<Message>;
        replyWithMediaGroup(
            media:
                | InputMediaAudio[]
                | InputMediaDocument[]
                | (InputMediaLivePhoto | InputMediaPhoto | InputMediaVideo)[],
            options?: Omit<SendMediaGroupParams, "chat_id" | "media">,
        ): Promise<Message[]>;
        replyWithPaidMedia(
            starCount: number,
            media: (
                InputPaidMediaLivePhoto
                | InputPaidMediaPhoto
                | InputPaidMediaVideo
            )[],
            options?: Omit<SendPaidMediaParams, "chat_id" | "media" | "star_count">,
        ): Promise<Message>;
        replyWithPhoto(
            photo: string | InputFile,
            options?: Omit<SendPhotoParams, "chat_id" | "photo">,
        ): Promise<Message>;
        replyWithPoll(
            question: string,
            pollOptions: (string | InputPollOption)[],
            options?: Omit<SendPollParams, "chat_id" | "question" | "options">,
        ): Promise<Message>;
        replyWithRichDraft(
            draftId: number,
            richMessage: (
                | { html: string; markdown?: undefined }
                | { html?: undefined; markdown: string }
            ) & Pick<InputRichMessage, "is_rtl" | "skip_entity_detection">,
            options?: Omit<
                SendRichMessageDraftParams,
                "chat_id"
                | "rich_message"
                | "draft_id",
            >,
        ): Promise<boolean>;
        replyWithRichMessage(
            richMessage: (
                | { html: string; markdown?: undefined }
                | { html?: undefined; markdown: string }
            ) & Pick<InputRichMessage, "is_rtl" | "skip_entity_detection">,
            options?: Omit<SendRichMessageParams, "chat_id" | "rich_message">,
        ): Promise<Message>;
        replyWithVideo(
            video: string | InputFile,
            options?: Omit<SendVideoParams, "chat_id" | "video">,
        ): Promise<Message>;
        sendGift(
            giftId: string,
            options?: Omit<SendGiftParams, "chat_id" | "user_id" | "gift_id">,
        ): Promise<boolean>;
        setGameScore(
            score: number,
            options?: Omit<SetGameScoreParams, "user_id" | "score">,
        ): Promise<boolean | Message>;
    }

    Hierarchy (View Summary)

    Index

    Properties

    callbackQuery?: CallbackQuery
    menu?: InlineMenuManager<any>
    session: SessionData
    update: Update

    Accessors

    • get channel(): ChannelContext

      Channel-specific operations context.

      Returns ChannelContext

    • get chatId(): number | undefined

      Returns number | undefined

    • get from(): User | undefined

      Returns User | undefined

    • get game(): GameContext

      Game-specific operations context.

      Returns GameContext

    • get group(): GroupContext

      Group-specific operations context.

      Returns GroupContext

    • get isMessageAccessible(): boolean

      Returns boolean

    • get payload(): string

      Returns command arguments (everything that follows the command name). Example: for the message "/start ref_123", it will return "ref_123". If it is just "/start", it will return an empty string.

      Returns string

      string

    • get senderId(): number | undefined

      ID of the user who initiated the event

      Returns number | undefined

      number | undefined

    • get text(): string | undefined

      Returns string | undefined

    Methods

    • Remove loading indicator from an inline button

      Parameters

      • Optionalparams: string | Omit<AnswerCallbackQueryParams, "callback_query_id">

        Parameters object or just the notification text

      Returns Promise<boolean>

      Promise<boolean>

    • Answer a pre-checkout query (Pre-checkout Query)

      Parameters

      • ok: boolean

        Is everything okay

      • OptionalerrorMessage: string

        Error message

      Returns Promise<boolean>

      Promise<boolean>

    • Answer a shipping query (Shipping Query)

      Parameters

      • ok: boolean

        Is everything okay

      • Optionaloptions: Omit<AnswerShippingQueryParams, "shipping_query_id" | "ok">

        Additional parameters

      Returns Promise<boolean>

      Promise<boolean>

    • Copy the current message to another chat

      Parameters

      • toChatId: string | number

        ID of the chat where the message is copied

      Returns Promise<MessageId>

      Promise<MessageId>

    • Delete all reactions of a specific user in the current chat (up to 10,000). By default, deletes the reactions of the user who initiated the event.

      Parameters

      Returns Promise<boolean>

      Promise<boolean>

    • Delete the current message

      Returns Promise<boolean>

      Promise<boolean>

    • Delete reaction on the current message. By default, deletes the reaction of the user who initiated the event.

      Parameters

      Returns Promise<boolean>

      Promise<boolean>

    • Change the caption of the current media file (photo/video)

      Parameters

      • caption: string

        caption

      • Optionaloptions: Omit<EditMessageCaptionParams, "caption" | "chat_id" | "message_id">

        parameters object

      Returns Promise<boolean | Message>

      Promise<Message | boolean>

    • Edit the text or rich content of the current message. Pass a string to edit as plain text, or a rich message object with html/markdown for rich content.

      Parameters

      • content:
            | string
            | (
                ({ html: string; markdown?: undefined; } | { markdown: string; html?: undefined; }) & Pick<InputRichMessage, "is_rtl" | "skip_entity_detection">
            )

        New message text (string) or rich message object (exactly one of html or markdown)

      • Optionaloptions: Omit<EditMessageTextParams, "text" | "chat_id" | "message_id" | "rich_message">

        Additional parameters

      Returns Promise<boolean | Message>

      Promise<Message | boolean>

    • Change only the inline keyboard of the current message or a specific message

      Parameters

      • OptionalreplyMarkup: InlineKeyboardMarkup

        keyboard (pass undefined to remove)

      • OptionalmessageId: number

        optional message ID (defaults to the current message)

      Returns Promise<boolean | Message>

      Promise<Message | boolean>

    • Forward the current message to another chat

      Parameters

      • toChatId: string | number

        ID of the chat where the message is forwarded

      Returns Promise<Message>

      Promise<Message>

    • Get the list of administrators of the current chat

      Returns Promise<ChatMember[]>

      Promise<ChatMember[]>

    • Get information about a specific member in the current chat

      Parameters

      • userId: number

        User ID

      Returns Promise<ChatMember>

      Promise<ChatMember>

    • Parameters

      • operation: string

      Returns { chatId: number; messageId: number }

    • Parameters

      • operation: string
      • force: true

      Returns { chatId: number; messageId: number }

    • Parameters

      • operation: string
      • force: false

      Returns { chatId: number; messageId: number | undefined }

    • Leave the current chat (group/channel)

      Returns Promise<boolean>

      Promise<boolean>

    • React to the current message

      Parameters

      • reactions: ReactionType[]

        Array of reactions (e.g.: [{ type: "emoji", emoji: "👍" }])

      Returns Promise<boolean>

      Promise<boolean>

    • Send chat action status to the current chat (e.g., "typing", "upload_photo") Automatically detects message_thread_id for forum topics.

      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"

        Action status (e.g., "typing", "upload_photo")

      • Optionaloptions: Omit<SendChatActionParams, "chat_id" | "action">

        Additional parameters

      Returns Promise<boolean>

      Promise<boolean>

    • Reply to the current message with a document (file)

      Parameters

      • document: string | InputFile

        URL of the file or file_id

      • Optionaloptions: Omit<SendDocumentParams, "chat_id" | "document">

        Parameters object or just the notification text

      Returns Promise<Message>

      Promise<Message>

    • Streaming a temporary message (Draft) for generating responses (e.g., AI). This ephemeral message lives for 30 seconds. After completion, it is mandatory to call a regular reply().

      Parameters

      • draftId: number

        unique stream identifier (must be > 0). Identical IDs animate changes.

      • Optionaloptions: Omit<SendMessageDraftParams, "chat_id" | "draft_id">

        parameters object

      Returns Promise<boolean>

      Promise<boolean>

    • Send a game to the current chat

      Parameters

      • gameShortName: string

        short name of the game

      • Optionaloptions: Omit<SendGameParams, "chat_id" | "game_short_name">

        parameters object

      Returns Promise<Message>

      Promise<Message>

    • Reply to the current message with a "live photo" (Live Photo)

      Parameters

      • photo: string | InputFile

        URL of the photo or file_id

      • livePhoto: string | InputFile

        URL of the "live photo" or file_id

      • Optionaloptions: Omit<SendLivePhotoParams, "chat_id" | "photo" | "live_photo">

        Parameters object or just the notification text

      Returns Promise<Message>

      Promise<Message>

    • Reply to the current message with a photo

      Parameters

      • photo: string | InputFile

        URL of the image or file_id

      • Optionaloptions: Omit<SendPhotoParams, "chat_id" | "photo">

        Parameters object or just the notification text

      Returns Promise<Message>

      Promise<Message>

    • Send a poll or quiz (Poll / Quiz) to the current chat. Supports new API 10.0 features: media, explanation_media, 1 answer option.

      Parameters

      • question: string

        poll text

      • pollOptions: (string | InputPollOption)[]

        answer options

      • Optionaloptions: Omit<SendPollParams, "chat_id" | "question" | "options">

        parameters object

      Returns Promise<Message>

      Promise<Message>

    • Stream a partial rich message to the user while the message is being generated. The streamed draft is ephemeral (30-second preview). Once finalized, call replyWithRichMessage to persist it.

      Parameters

      • draftId: number

        Unique identifier of the message draft; must be non-zero. Same IDs animate changes.

      • richMessage: (
            | { html: string; markdown?: undefined }
            | { html?: undefined; markdown: string }
        ) & Pick<InputRichMessage, "is_rtl" | "skip_entity_detection">

        The partial rich message to be streamed. Exactly one of html or markdown must be provided.

      • Optionaloptions: Omit<SendRichMessageDraftParams, "chat_id" | "rich_message" | "draft_id">

        Additional parameters

      Returns Promise<boolean>

      Promise<boolean>

    • Reply to the current message with a rich message (HTML or Markdown).

      Parameters

      • richMessage: (
            | { html: string; markdown?: undefined }
            | { html?: undefined; markdown: string }
        ) & Pick<InputRichMessage, "is_rtl" | "skip_entity_detection">

        Rich message object. Exactly one of the fields html or markdown must be provided.

      • Optionaloptions: Omit<SendRichMessageParams, "chat_id" | "rich_message">

        Additional parameters

      Returns Promise<Message>

      Promise<Message>

    • Reply to the current message with a video file

      Parameters

      • video: string | InputFile

        URL of the video or file_id

      • Optionaloptions: Omit<SendVideoParams, "chat_id" | "video">

        Parameters object or just the notification text

      Returns Promise<Message>

      Promise<Message>

    • Send a gift (Star Gift) to the current user

      Parameters

      • giftId: string

        Gift ID

      • Optionaloptions: Omit<SendGiftParams, "chat_id" | "user_id" | "gift_id">

        Parameters object

      Returns Promise<boolean>

      Promise<boolean>

    • Set a high score for a player in the game

      Parameters

      • score: number

        game score

      • Optionaloptions: Omit<SetGameScoreParams, "user_id" | "score">

        parameters object

      Returns Promise<boolean | Message>

      Promise<Message | boolean>