import { type CallbackQueryX } from "./data/callback-query.js"; import { type ChatJoinRequestX } from "./data/chat-join-request.js"; import { type ChatX } from "./data/chat.js"; import { type InlineQueryX } from "./data/inline-query.js"; import { type MessageX } from "./data/message.js"; import { type PreCheckoutQueryX } from "./data/pre-checkout-query.js"; import { type ShippingQueryX } from "./data/shipping-query.js"; import { UpdateX } from "./data/update.js"; import { type ChatMemberX } from "./data/user.js"; import { type Api, type Context, type Opts, type RawApi, type Transformer } from "./deps.node.js"; /** * Transformative API Flavor that adds file handling utilities to the supplied * context object. Check out the * [documentation](https://grammy.dev/guide/context.html#transformative-context-flavours) * about this kind of context flavor. */ export type HydrateFlavor = ObjectAssign>; export type HydrateApiFlavor = ApiX; /** * Mapping table from method names to API call result extensions. * * In other words, every key K of this interface identifies a method of the Bot * API that exists as method on `ctx`, `ctx.api`, and `ctx.api.raw`. The return * type of every one of these three methods will be augmented by `X[K]` via type * intersection. */ interface X { sendMessage: MessageX; forwardMessage: MessageX; sendPhoto: MessageX; sendAudio: MessageX; sendDocument: MessageX; sendVideo: MessageX; sendAnimation: MessageX; sendVoice: MessageX; sendVideoNote: MessageX; editMessageLiveLocation: MessageX | true; stopMessageLiveLocation: MessageX | true; sendVenue: MessageX; sendContact: MessageX; sendPoll: MessageX; sendDice: MessageX; editMessageText: MessageX | true; editMessageCaption: MessageX | true; editMessageMedia: MessageX | true; editMessageReplyMarkup: MessageX | true; sendSticker: MessageX; sendInvoice: MessageX; sendGame: MessageX; setGameScore: MessageX | true; getChat: ChatX; getChatMember: ChatMemberX; } /** * Plugin that hydrates the context object and API call results, and equips the * objects with useful methods that are calling `bot.api` with values prefilled * from the object they are installed on. * * For example, this plugin allows you to use `await ctx.message.delete()` instead of * `await ctx.deleteMessage()`. * * Check out [the official plugin * documentation](https://grammy.dev/plugins/hydrate.html) on the grammY * webiste. */ export declare function hydrate(): (ctx: HydrateFlavor, next: () => Promise) => Promise; export declare function hydrateContext(): (ctx: HydrateFlavor, next: () => Promise) => Promise; export declare function hydrateApi(): Transformer; export type Other = Omit, K>; export type Ret = ReturnType; type ObjectAssign = { [Key in keyof (DestType & SourceType)]: Key extends keyof SourceType ? SourceType[Key] : Key extends keyof DestType ? DestType[Key] : never; }; interface ContextX { api: ApiX; reply: Extend; forwardMessage: Extend; replyWithPhoto: Extend; replyWithAudio: Extend; replyWithDocument: Extend; replyWithVideo: Extend; replyWithAnimation: Extend; replyWithVoice: Extend; replyWithVideoNote: Extend; editMessageLiveLocation: Extend; stopMessageLiveLocation: Extend; replyWithVenue: Extend; replyWithContact: Extend; replyWithPoll: Extend; replyWithDice: Extend; editMessageText: Extend; editMessageCaption: Extend; editMessageMedia: Extend; editMessageReplyMarkup: Extend; replyWithSticker: Extend; replyWithInvoice: Extend; replyWithGame: Extend; getChatMember: Extend; getChat: Extend; getAuthor: Extend; update: UpdateX; message: (MessageX | undefined) & C["message"]; editedMessage: (MessageX | undefined) & C["editedMessage"]; channelPost: (MessageX | undefined) & C["channelPost"]; editedChannelPost: (MessageX | undefined) & C["editedChannelPost"]; inlineQuery: (InlineQueryX | undefined) & C["inlineQuery"]; callbackQuery: (CallbackQueryX | undefined) & C["callbackQuery"]; shippingQuery: (ShippingQueryX | undefined) & C["shippingQuery"]; preCheckoutQuery: (PreCheckoutQueryX | undefined) & C["preCheckoutQuery"]; chatJoinRequest: (ChatJoinRequestX | undefined) & C["chatJoinRequest"]; msg: (MessageX | undefined) & C["msg"]; } type ApiX = AddX & { raw: RawApiX; }; type RawApiX = AddX; type AddX any>> = { [K in keyof Q]: K extends keyof X ? Extend : Q[K]; }; type Extend any, X> = (...args: Parameters) => Promise> & X>; type Await = T extends PromiseLike ? Await : T; export {};