import * as tg from './core/types/typegram'; import * as tt from './telegram-types'; import { Deunionize, PropOr, UnionKeys } from './deunionize'; import ApiClient from './core/network/client'; import Telegram from './telegram'; declare type Tail = T extends [unknown, ...infer U] ? U : never; declare type Shorthand> = Tail>; export declare class Context = tg.Update> { readonly update: U; readonly telegram: Telegram; readonly botInfo: tg.UserFromGetMe; readonly state: Record; constructor(update: U, telegram: Telegram, botInfo: tg.UserFromGetMe); get updateType(): Extract, tt.UpdateType>; get me(): string; /** * @deprecated Use ctx.telegram instead */ get tg(): Telegram; get message(): PropOr; get editedMessage(): PropOr; get inlineQuery(): PropOr; get shippingQuery(): PropOr; get preCheckoutQuery(): PropOr; get chosenInlineResult(): PropOr; get channelPost(): PropOr; get editedChannelPost(): PropOr; get callbackQuery(): PropOr; get poll(): PropOr; get pollAnswer(): PropOr; get myChatMember(): PropOr; get chatMember(): PropOr; get chatJoinRequest(): tg.ChatJoinRequest | undefined; get chat(): Getter; get senderChat(): PropOr, "sender_chat", undefined>; get from(): PropOr, "from", undefined>; get inlineMessageId(): string | undefined; get passportData(): tg.PassportData | undefined; get webAppData(): { data: { json(): T; text(): string; }; button_text: string; } | undefined; /** * @deprecated use {@link Telegram.webhookReply} */ get webhookReply(): boolean; set webhookReply(enable: boolean); /** * @see https://core.telegram.org/bots/api#answerinlinequery */ answerInlineQuery(this: Context, ...args: Shorthand<'answerInlineQuery'>): Promise; /** * @see https://core.telegram.org/bots/api#answercallbackquery */ answerCbQuery(this: Context, ...args: Shorthand<'answerCbQuery'>): Promise; /** * @see https://core.telegram.org/bots/api#answercallbackquery */ answerGameQuery(this: Context, ...args: Shorthand<'answerGameQuery'>): Promise; /** * @see https://core.telegram.org/bots/api#answershippingquery */ answerShippingQuery(this: Context, ...args: Shorthand<'answerShippingQuery'>): Promise; /** * @see https://core.telegram.org/bots/api#answerprecheckoutquery */ answerPreCheckoutQuery(this: Context, ...args: Shorthand<'answerPreCheckoutQuery'>): Promise; /** * @see https://core.telegram.org/bots/api#editmessagetext */ editMessageText(this: Context, text: string, extra?: tt.ExtraEditMessageText): Promise; /** * @see https://core.telegram.org/bots/api#editmessagecaption */ editMessageCaption(this: Context, caption: string | undefined, extra?: tt.ExtraEditMessageCaption): Promise; /** * @see https://core.telegram.org/bots/api#editmessagemedia */ editMessageMedia(this: Context, media: tg.InputMedia, extra?: tt.ExtraEditMessageMedia): Promise; /** * @see https://core.telegram.org/bots/api#editmessagereplymarkup */ editMessageReplyMarkup(this: Context, markup: tg.InlineKeyboardMarkup | undefined): Promise; /** * @see https://core.telegram.org/bots/api#editmessagelivelocation */ editMessageLiveLocation(this: Context, latitude: number, longitude: number, extra?: tt.ExtraEditMessageLiveLocation): Promise; /** * @see https://core.telegram.org/bots/api#stopmessagelivelocation */ stopMessageLiveLocation(this: Context, markup?: tg.InlineKeyboardMarkup): Promise; /** * @see https://core.telegram.org/bots/api#sendmessage */ sendMessage(this: Context, ...args: Shorthand<'sendMessage'>): Promise; /** * @see https://core.telegram.org/bots/api#sendmessage */ reply(this: Context, ...args: Shorthand<'sendMessage'>): Promise; /** * @see https://core.telegram.org/bots/api#getchat */ getChat(this: Context, ...args: Shorthand<'getChat'>): Promise; /** * @see https://core.telegram.org/bots/api#exportchatinvitelink */ exportChatInviteLink(this: Context, ...args: Shorthand<'exportChatInviteLink'>): Promise; /** * @see https://core.telegram.org/bots/api#createchatinvitelink */ createChatInviteLink(this: Context, ...args: Shorthand<'createChatInviteLink'>): Promise; /** * @see https://core.telegram.org/bots/api#editchatinvitelink */ editChatInviteLink(this: Context, ...args: Shorthand<'editChatInviteLink'>): Promise; /** * @see https://core.telegram.org/bots/api#revokechatinvitelink */ revokeChatInviteLink(this: Context, ...args: Shorthand<'revokeChatInviteLink'>): Promise; /** * @see https://core.telegram.org/bots/api#banchatmember */ banChatMember(this: Context, ...args: Shorthand<'banChatMember'>): Promise; /** * @see https://core.telegram.org/bots/api#banchatmember * @deprecated since API 5.3. Use {@link Context.banChatMember} */ get kickChatMember(): (this: Context, userId: number, untilDate?: number | undefined, extra?: Omit<{ chat_id: string | number; user_id: number; until_date?: number | undefined; revoke_messages?: boolean | undefined; }, "chat_id" | "user_id" | "until_date"> | undefined) => Promise; /** * @see https://core.telegram.org/bots/api#unbanchatmember */ unbanChatMember(this: Context, ...args: Shorthand<'unbanChatMember'>): Promise; /** * @see https://core.telegram.org/bots/api#restrictchatmember */ restrictChatMember(this: Context, ...args: Shorthand<'restrictChatMember'>): Promise; /** * @see https://core.telegram.org/bots/api#promotechatmember */ promoteChatMember(this: Context, ...args: Shorthand<'promoteChatMember'>): Promise; /** * @see https://core.telegram.org/bots/api#setchatadministratorcustomtitle */ setChatAdministratorCustomTitle(this: Context, ...args: Shorthand<'setChatAdministratorCustomTitle'>): Promise; /** * @see https://core.telegram.org/bots/api#setchatphoto */ setChatPhoto(this: Context, ...args: Shorthand<'setChatPhoto'>): Promise; /** * @see https://core.telegram.org/bots/api#deletechatphoto */ deleteChatPhoto(this: Context, ...args: Shorthand<'deleteChatPhoto'>): Promise; /** * @see https://core.telegram.org/bots/api#setchattitle */ setChatTitle(this: Context, ...args: Shorthand<'setChatTitle'>): Promise; /** * @see https://core.telegram.org/bots/api#setchatdescription */ setChatDescription(this: Context, ...args: Shorthand<'setChatDescription'>): Promise; /** * @see https://core.telegram.org/bots/api#pinchatmessage */ pinChatMessage(this: Context, ...args: Shorthand<'pinChatMessage'>): Promise; /** * @see https://core.telegram.org/bots/api#unpinchatmessage */ unpinChatMessage(this: Context, ...args: Shorthand<'unpinChatMessage'>): Promise; /** * @see https://core.telegram.org/bots/api#unpinallchatmessages */ unpinAllChatMessages(this: Context, ...args: Shorthand<'unpinAllChatMessages'>): Promise; /** * @see https://core.telegram.org/bots/api#leavechat */ leaveChat(this: Context, ...args: Shorthand<'leaveChat'>): Promise; /** * @see https://core.telegram.org/bots/api#setchatpermissions */ setChatPermissions(this: Context, ...args: Shorthand<'setChatPermissions'>): Promise; /** * @see https://core.telegram.org/bots/api#getchatadministrators */ getChatAdministrators(this: Context, ...args: Shorthand<'getChatAdministrators'>): Promise<(tg.ChatMemberOwner | tg.ChatMemberAdministrator)[]>; /** * @see https://core.telegram.org/bots/api#getchatmember */ getChatMember(this: Context, ...args: Shorthand<'getChatMember'>): Promise; /** * @see https://core.telegram.org/bots/api#getchatmembercount */ getChatMembersCount(this: Context, ...args: Shorthand<'getChatMembersCount'>): Promise; /** * @see https://core.telegram.org/bots/api#setpassportdataerrors */ setPassportDataErrors(this: Context, errors: readonly tg.PassportElementError[]): Promise; /** * @see https://core.telegram.org/bots/api#sendphoto */ sendPhoto(this: Context, ...args: Shorthand<'sendPhoto'>): Promise; /** * @see https://core.telegram.org/bots/api#sendphoto */ replyWithPhoto(this: Context, ...args: Shorthand<'sendPhoto'>): Promise; /** * @see https://core.telegram.org/bots/api#sendmediagroup */ sendMediaGroup(this: Context, ...args: Shorthand<'sendMediaGroup'>): Promise<(tg.Message.DocumentMessage | tg.Message.AudioMessage | tg.Message.PhotoMessage | tg.Message.VideoMessage)[]>; /** * @see https://core.telegram.org/bots/api#sendmediagroup */ replyWithMediaGroup(this: Context, ...args: Shorthand<'sendMediaGroup'>): Promise<(tg.Message.DocumentMessage | tg.Message.AudioMessage | tg.Message.PhotoMessage | tg.Message.VideoMessage)[]>; /** * @see https://core.telegram.org/bots/api#sendaudio */ sendAudio(this: Context, ...args: Shorthand<'sendAudio'>): Promise; /** * @see https://core.telegram.org/bots/api#sendaudio */ replyWithAudio(this: Context, ...args: Shorthand<'sendAudio'>): Promise; /** * @see https://core.telegram.org/bots/api#senddice */ sendDice(this: Context, ...args: Shorthand<'sendDice'>): Promise; /** * @see https://core.telegram.org/bots/api#senddice */ replyWithDice(this: Context, ...args: Shorthand<'sendDice'>): Promise; /** * @see https://core.telegram.org/bots/api#senddocument */ sendDocument(this: Context, ...args: Shorthand<'sendDocument'>): Promise; /** * @see https://core.telegram.org/bots/api#senddocument */ replyWithDocument(this: Context, ...args: Shorthand<'sendDocument'>): Promise; /** * @see https://core.telegram.org/bots/api#sendsticker */ sendSticker(this: Context, ...args: Shorthand<'sendSticker'>): Promise; /** * @see https://core.telegram.org/bots/api#sendsticker */ replyWithSticker(this: Context, ...args: Shorthand<'sendSticker'>): Promise; /** * @see https://core.telegram.org/bots/api#sendvideo */ sendVideo(this: Context, ...args: Shorthand<'sendVideo'>): Promise; /** * @see https://core.telegram.org/bots/api#sendvideo */ replyWithVideo(this: Context, ...args: Shorthand<'sendVideo'>): Promise; /** * @see https://core.telegram.org/bots/api#sendanimation */ sendAnimation(this: Context, ...args: Shorthand<'sendAnimation'>): Promise; /** * @see https://core.telegram.org/bots/api#sendanimation */ replyWithAnimation(this: Context, ...args: Shorthand<'sendAnimation'>): Promise; /** * @see https://core.telegram.org/bots/api#sendvideonote */ sendVideoNote(this: Context, ...args: Shorthand<'sendVideoNote'>): Promise; /** * @see https://core.telegram.org/bots/api#sendvideonote */ replyWithVideoNote(this: Context, ...args: Shorthand<'sendVideoNote'>): Promise; /** * @see https://core.telegram.org/bots/api#sendinvoice */ sendInvoice(this: Context, ...args: Shorthand<'sendInvoice'>): Promise; /** * @see https://core.telegram.org/bots/api#sendinvoice */ replyWithInvoice(this: Context, ...args: Shorthand<'sendInvoice'>): Promise; /** * @see https://core.telegram.org/bots/api#sendgame */ sendGame(this: Context, ...args: Shorthand<'sendGame'>): Promise; /** * @see https://core.telegram.org/bots/api#sendgame */ replyWithGame(this: Context, ...args: Shorthand<'sendGame'>): Promise; /** * @see https://core.telegram.org/bots/api#sendvoice */ sendVoice(this: Context, ...args: Shorthand<'sendVoice'>): Promise; /** * @see https://core.telegram.org/bots/api#sendvoice */ replyWithVoice(this: Context, ...args: Shorthand<'sendVoice'>): Promise; /** * @see https://core.telegram.org/bots/api#sendpoll */ sendPoll(this: Context, ...args: Shorthand<'sendPoll'>): Promise; /** * @see https://core.telegram.org/bots/api#sendpoll */ replyWithPoll(this: Context, ...args: Shorthand<'sendPoll'>): Promise; /** * @see https://core.telegram.org/bots/api#sendquiz */ sendQuiz(this: Context, ...args: Shorthand<'sendQuiz'>): Promise; /** * @see https://core.telegram.org/bots/api#sendquiz */ replyWithQuiz(this: Context, ...args: Shorthand<'sendQuiz'>): Promise; /** * @see https://core.telegram.org/bots/api#stoppoll */ stopPoll(this: Context, ...args: Shorthand<'stopPoll'>): Promise; /** * @see https://core.telegram.org/bots/api#sendchataction */ sendChatAction(this: Context, ...args: Shorthand<'sendChatAction'>): Promise; /** * @deprecated use {@link Context.sendChatAction} instead * @see https://core.telegram.org/bots/api#sendchataction */ replyWithChatAction(this: Context, ...args: Shorthand<'sendChatAction'>): Promise; /** * @see https://core.telegram.org/bots/api#sendlocation */ sendLocation(this: Context, ...args: Shorthand<'sendLocation'>): Promise; /** * @see https://core.telegram.org/bots/api#sendlocation */ replyWithLocation(this: Context, ...args: Shorthand<'sendLocation'>): Promise; /** * @see https://core.telegram.org/bots/api#sendvenue */ sendVenue(this: Context, ...args: Shorthand<'sendVenue'>): Promise; /** * @see https://core.telegram.org/bots/api#sendvenue */ replyWithVenue(this: Context, ...args: Shorthand<'sendVenue'>): Promise; /** * @see https://core.telegram.org/bots/api#sendcontact */ sendContact(this: Context, ...args: Shorthand<'sendContact'>): Promise; /** * @see https://core.telegram.org/bots/api#sendcontact */ replyWithContact(this: Context, ...args: Shorthand<'sendContact'>): Promise; /** * @deprecated use {@link Telegram.getStickerSet} * @see https://core.telegram.org/bots/api#getstickerset */ getStickerSet(this: Context, setName: string): Promise; /** * @see https://core.telegram.org/bots/api#setchatstickerset */ setChatStickerSet(this: Context, setName: string): Promise; /** * @see https://core.telegram.org/bots/api#deletechatstickerset */ deleteChatStickerSet(this: Context): Promise; /** * @deprecated use {@link Telegram.setStickerPositionInSet} * @see https://core.telegram.org/bots/api#setstickerpositioninset */ setStickerPositionInSet(this: Context, sticker: string, position: number): Promise; /** * @deprecated use {@link Telegram.setStickerSetThumb} * @see https://core.telegram.org/bots/api#setstickersetthumb */ setStickerSetThumb(this: Context, ...args: Parameters): Promise; /** * @deprecated use {@link Telegram.deleteStickerFromSet} * @see https://core.telegram.org/bots/api#deletestickerfromset */ deleteStickerFromSet(this: Context, sticker: string): Promise; /** * @see https://core.telegram.org/bots/api#uploadstickerfile */ uploadStickerFile(this: Context, ...args: Shorthand<'uploadStickerFile'>): Promise; /** * @see https://core.telegram.org/bots/api#createnewstickerset */ createNewStickerSet(this: Context, ...args: Shorthand<'createNewStickerSet'>): Promise; /** * @see https://core.telegram.org/bots/api#addstickertoset */ addStickerToSet(this: Context, ...args: Shorthand<'addStickerToSet'>): Promise; /** * @deprecated use {@link Telegram.getMyCommands} * @see https://core.telegram.org/bots/api#getmycommands */ getMyCommands(this: Context): Promise; /** * @deprecated use {@link Telegram.setMyCommands} * @see https://core.telegram.org/bots/api#setmycommands */ setMyCommands(this: Context, commands: readonly tg.BotCommand[]): Promise; /** * @deprecated use {@link Context.replyWithMarkdownV2} * @see https://core.telegram.org/bots/api#sendmessage */ replyWithMarkdown(this: Context, markdown: string, extra?: tt.ExtraReplyMessage): Promise; /** * @see https://core.telegram.org/bots/api#sendmessage */ replyWithMarkdownV2(this: Context, markdown: string, extra?: tt.ExtraReplyMessage): Promise; /** * @see https://core.telegram.org/bots/api#sendmessage */ replyWithHTML(this: Context, html: string, extra?: tt.ExtraReplyMessage): Promise; /** * @see https://core.telegram.org/bots/api#deletemessage */ deleteMessage(this: Context, messageId?: number): Promise; /** * @see https://core.telegram.org/bots/api#forwardmessage */ forwardMessage(this: Context, chatId: string | number, extra?: { disable_notification?: boolean; }): Promise; /** * @see https://core.telegram.org/bots/api#copymessage */ copyMessage(this: Context, chatId: string | number, extra?: tt.ExtraCopyMessage): Promise; /** * @see https://core.telegram.org/bots/api#approvechatjoinrequest */ approveChatJoinRequest(this: Context, userId: number): Promise; /** * @see https://core.telegram.org/bots/api#declinechatjoinrequest */ declineChatJoinRequest(this: Context, userId: number): Promise; /** * @see https://core.telegram.org/bots/api#banchatsenderchat */ banChatSenderChat(this: Context, senderChatId: number): Promise; /** * @see https://core.telegram.org/bots/api#unbanchatsenderchat */ unbanChatSenderChat(this: Context, senderChatId: number): Promise; /** * Use this method to change the bot's menu button in the current private chat. Returns true on success. * @see https://core.telegram.org/bots/api#setchatmenubutton */ setChatMenuButton(this: Context, menuButton?: tg.MenuButton): Promise; /** * Use this method to get the current value of the bot's menu button in the current private chat. Returns MenuButton on success. * @see https://core.telegram.org/bots/api#getchatmenubutton */ getChatMenuButton(): Promise; /** * @see https://core.telegram.org/bots/api#setmydefaultadministratorrights */ setMyDefaultAdministratorRights(extra?: Parameters[0]): Promise; /** * @see https://core.telegram.org/bots/api#getmydefaultadministratorrights */ getMyDefaultAdministratorRights(extra?: Parameters[0]): Promise; } export default Context; declare type UpdateTypes> = Extract, tt.UpdateType>; export declare type GetUpdateContent = U extends tg.Update.CallbackQueryUpdate ? U['callback_query']['message'] : U[UpdateTypes]; declare type Getter, P extends string> = PropOr, P>; //# sourceMappingURL=context.d.ts.map