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 chatId(): number | undefined;
        get from(): User | undefined;
        get isMessageAccessible(): boolean;
        get payload(): string;
        get senderId(): number | undefined;
        get text(): string | undefined;
        answerCbQuery(
            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>;
        editMessage(
            text: string,
            options?: Omit<EditMessageTextParams, "text" | "chat_id" | "message_id">,
        ): Promise<boolean | Message>;
        editReplyMarkup(
            replyMarkup?: InlineKeyboardMarkup,
        ): 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",
        ): Promise<boolean>;
        replyWithDocument(
            document: string | InputFile,
            options?: Omit<SendDocumentParams, "chat_id" | "document">,
        ): Promise<Message>;
        replyWithDraft(
            draftId: number,
            options?: Omit<SendMessageDraftParams, "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>;
        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 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

    Methods

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

      Parameters

      • ok: boolean

        Is everything okay

      • OptionalerrorMessage: string

        Error message

      Returns Promise<boolean>

      Promise<boolean>

    • Send chat action status to the current chat (e.g., "typing", "upload_photo")

      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")

      Returns Promise<boolean>

      Promise<boolean>

    • 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, "draft_id">

        parameters object

      Returns Promise<boolean>

      Promise<boolean>

    • 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>