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 tg: Telegram; readonly botInfo: tg.UserFromGetMe; readonly state: Record; constructor(update: U, tg: Telegram, botInfo: tg.UserFromGetMe); get updateType(): Extract, tt.UpdateType>; get me(): string; get telegram(): 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 chat(): Getter; get senderChat(): PropOr, "sender_chat", undefined>; get from(): PropOr, "from", undefined>; get inlineMessageId(): string | undefined; get passportData(): tg.PassportData | undefined; /** * @deprecated use {@link Telegram.webhookReply} */ get webhookReply(): boolean; set webhookReply(enable: boolean); private assert; /** * @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 */ 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 */ kickChatMember(this: Context, ...args: Shorthand<'kickChatMember'>): 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; /** * @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#replywithphoto */ replyWithPhoto(this: Context, ...args: Shorthand<'sendPhoto'>): Promise; /** * @see https://core.telegram.org/bots/api#replywithmediagroup */ 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#replywithaudio */ replyWithAudio(this: Context, ...args: Shorthand<'sendAudio'>): Promise; /** * @see https://core.telegram.org/bots/api#replywithdice */ replyWithDice(this: Context, ...args: Shorthand<'sendDice'>): Promise; /** * @see https://core.telegram.org/bots/api#replywithdocument */ replyWithDocument(this: Context, ...args: Shorthand<'sendDocument'>): Promise; /** * @see https://core.telegram.org/bots/api#replywithsticker */ replyWithSticker(this: Context, ...args: Shorthand<'sendSticker'>): Promise; /** * @see https://core.telegram.org/bots/api#replywithvideo */ replyWithVideo(this: Context, ...args: Shorthand<'sendVideo'>): Promise; /** * @see https://core.telegram.org/bots/api#replywithanimation */ replyWithAnimation(this: Context, ...args: Shorthand<'sendAnimation'>): Promise; /** * @see https://core.telegram.org/bots/api#replywithvideonote */ replyWithVideoNote(this: Context, ...args: Shorthand<'sendVideoNote'>): Promise; /** * @see https://core.telegram.org/bots/api#replywithinvoice */ replyWithInvoice(this: Context, ...args: Shorthand<'sendInvoice'>): Promise; /** * @see https://core.telegram.org/bots/api#replywithgame */ replyWithGame(this: Context, ...args: Shorthand<'sendGame'>): Promise; /** * @see https://core.telegram.org/bots/api#replywithvoice */ replyWithVoice(this: Context, ...args: Shorthand<'sendVoice'>): Promise; /** * @see https://core.telegram.org/bots/api#replywithpoll */ replyWithPoll(this: Context, ...args: Shorthand<'sendPoll'>): Promise; /** * @see https://core.telegram.org/bots/api#replywithquiz */ 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#replywithchataction */ replyWithChatAction(this: Context, ...args: Shorthand<'sendChatAction'>): Promise; /** * @see https://core.telegram.org/bots/api#replywithlocation */ replyWithLocation(this: Context, ...args: Shorthand<'sendLocation'>): Promise; /** * @see https://core.telegram.org/bots/api#replywithvenue */ replyWithVenue(this: Context, ...args: Shorthand<'sendVenue'>): Promise; /** * @see https://core.telegram.org/bots/api#replywithcontact */ 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; /** * @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; } 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