import { HookFn, HookHandlerTx } from "@fragno-dev/db"; import { z } from "zod"; //#region src/types.d.ts declare const telegramChatTypeSchema: z.ZodEnum<{ private: "private"; group: "group"; supergroup: "supergroup"; channel: "channel"; }>; type TelegramChatType = z.infer; type TelegramCommandScope = TelegramChatType; declare const telegramPhotoSizeSchema: z.ZodObject<{ fileId: z.ZodString; fileUniqueId: z.ZodString; width: z.ZodNumber; height: z.ZodNumber; fileSize: z.ZodOptional; }, z.core.$strip>; type TelegramPhotoSize = z.infer; declare const telegramVoiceSchema: z.ZodObject<{ fileId: z.ZodString; fileUniqueId: z.ZodString; duration: z.ZodNumber; mimeType: z.ZodOptional; fileSize: z.ZodOptional; }, z.core.$strip>; type TelegramVoice = z.infer; declare const telegramAudioSchema: z.ZodObject<{ fileId: z.ZodString; fileUniqueId: z.ZodString; duration: z.ZodNumber; performer: z.ZodOptional; title: z.ZodOptional; fileName: z.ZodOptional; mimeType: z.ZodOptional; fileSize: z.ZodOptional; thumbnail: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>; type TelegramAudio = z.infer; declare const telegramDocumentSchema: z.ZodObject<{ fileId: z.ZodString; fileUniqueId: z.ZodString; fileName: z.ZodOptional; mimeType: z.ZodOptional; fileSize: z.ZodOptional; thumbnail: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>; type TelegramDocument = z.infer; declare const telegramVideoSchema: z.ZodObject<{ fileId: z.ZodString; fileUniqueId: z.ZodString; width: z.ZodNumber; height: z.ZodNumber; duration: z.ZodNumber; fileName: z.ZodOptional; mimeType: z.ZodOptional; fileSize: z.ZodOptional; thumbnail: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>; type TelegramVideo = z.infer; declare const telegramVideoNoteSchema: z.ZodObject<{ fileId: z.ZodString; fileUniqueId: z.ZodString; length: z.ZodNumber; duration: z.ZodNumber; fileSize: z.ZodOptional; thumbnail: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>; type TelegramVideoNote = z.infer; declare const telegramStickerSchema: z.ZodObject<{ fileId: z.ZodString; fileUniqueId: z.ZodString; type: z.ZodEnum<{ regular: "regular"; mask: "mask"; custom_emoji: "custom_emoji"; }>; width: z.ZodNumber; height: z.ZodNumber; isAnimated: z.ZodBoolean; isVideo: z.ZodBoolean; thumbnail: z.ZodOptional; }, z.core.$strip>>; emoji: z.ZodOptional; setName: z.ZodOptional; fileSize: z.ZodOptional; }, z.core.$strip>; type TelegramSticker = z.infer; declare const telegramAnimationSchema: z.ZodObject<{ fileId: z.ZodString; fileUniqueId: z.ZodString; width: z.ZodNumber; height: z.ZodNumber; duration: z.ZodNumber; fileName: z.ZodOptional; mimeType: z.ZodOptional; fileSize: z.ZodOptional; thumbnail: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>; type TelegramAnimation = z.infer; declare const telegramAttachmentKindSchema: z.ZodEnum<{ photo: "photo"; voice: "voice"; audio: "audio"; document: "document"; video: "video"; video_note: "video_note"; sticker: "sticker"; animation: "animation"; }>; type TelegramAttachmentKind = z.infer; declare const telegramAttachmentPhotoSizeSchema: z.ZodObject<{ fileId: z.ZodString; fileUniqueId: z.ZodString; fileSize: z.ZodOptional; width: z.ZodNumber; height: z.ZodNumber; }, z.core.$strip>; type TelegramAttachmentPhotoSize = z.infer; declare const telegramAttachmentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{ kind: z.ZodLiteral<"photo">; fileId: z.ZodString; fileUniqueId: z.ZodString; fileSize: z.ZodOptional; width: z.ZodNumber; height: z.ZodNumber; thumbnail: z.ZodOptional; width: z.ZodNumber; height: z.ZodNumber; }, z.core.$strip>>; sizes: z.ZodArray; width: z.ZodNumber; height: z.ZodNumber; }, z.core.$strip>>; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"voice">; fileId: z.ZodString; fileUniqueId: z.ZodString; fileSize: z.ZodOptional; duration: z.ZodNumber; mimeType: z.ZodOptional; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"audio">; fileId: z.ZodString; fileUniqueId: z.ZodString; fileSize: z.ZodOptional; duration: z.ZodNumber; performer: z.ZodOptional; title: z.ZodOptional; fileName: z.ZodOptional; mimeType: z.ZodOptional; thumbnail: z.ZodOptional; width: z.ZodNumber; height: z.ZodNumber; }, z.core.$strip>>; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"document">; fileId: z.ZodString; fileUniqueId: z.ZodString; fileSize: z.ZodOptional; fileName: z.ZodOptional; mimeType: z.ZodOptional; thumbnail: z.ZodOptional; width: z.ZodNumber; height: z.ZodNumber; }, z.core.$strip>>; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"video">; fileId: z.ZodString; fileUniqueId: z.ZodString; fileSize: z.ZodOptional; width: z.ZodNumber; height: z.ZodNumber; duration: z.ZodNumber; fileName: z.ZodOptional; mimeType: z.ZodOptional; thumbnail: z.ZodOptional; width: z.ZodNumber; height: z.ZodNumber; }, z.core.$strip>>; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"video_note">; fileId: z.ZodString; fileUniqueId: z.ZodString; fileSize: z.ZodOptional; length: z.ZodNumber; duration: z.ZodNumber; thumbnail: z.ZodOptional; width: z.ZodNumber; height: z.ZodNumber; }, z.core.$strip>>; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"sticker">; fileId: z.ZodString; fileUniqueId: z.ZodString; fileSize: z.ZodOptional; width: z.ZodNumber; height: z.ZodNumber; emoji: z.ZodOptional; setName: z.ZodOptional; isAnimated: z.ZodBoolean; isVideo: z.ZodBoolean; thumbnail: z.ZodOptional; width: z.ZodNumber; height: z.ZodNumber; }, z.core.$strip>>; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"animation">; fileId: z.ZodString; fileUniqueId: z.ZodString; fileSize: z.ZodOptional; width: z.ZodNumber; height: z.ZodNumber; duration: z.ZodNumber; fileName: z.ZodOptional; mimeType: z.ZodOptional; thumbnail: z.ZodOptional; width: z.ZodNumber; height: z.ZodNumber; }, z.core.$strip>>; }, z.core.$strip>], "kind">; type TelegramAttachment = z.infer; declare const telegramMessageEntitySchema: z.ZodObject<{ type: z.ZodString; offset: z.ZodNumber; length: z.ZodNumber; }, z.core.$strip>; type TelegramMessageEntity = z.infer; declare const telegramUserSchema: z.ZodObject<{ id: z.ZodNumber; isBot: z.ZodBoolean; firstName: z.ZodString; lastName: z.ZodOptional; username: z.ZodOptional; languageCode: z.ZodOptional; }, z.core.$strip>; type TelegramUser = z.infer; declare const telegramChatSchema: z.ZodObject<{ id: z.ZodNumber; type: z.ZodEnum<{ private: "private"; group: "group"; supergroup: "supergroup"; channel: "channel"; }>; title: z.ZodOptional; username: z.ZodOptional; firstName: z.ZodOptional; lastName: z.ZodOptional; isForum: z.ZodOptional; }, z.core.$strip>; type TelegramChat = z.infer; interface TelegramMessage { messageId: number; date: number; editDate?: number; text?: string; from?: TelegramUser; senderChat?: TelegramChat; chat: TelegramChat; replyToMessage?: TelegramMessage; newChatMembers?: TelegramUser[]; leftChatMember?: TelegramUser; entities?: TelegramMessageEntity[]; mediaGroupId?: string; photo?: TelegramPhotoSize[]; voice?: TelegramVoice; audio?: TelegramAudio; document?: TelegramDocument; video?: TelegramVideo; videoNote?: TelegramVideoNote; sticker?: TelegramSticker; animation?: TelegramAnimation; } interface TelegramUpdate { updateId: number; message?: TelegramMessage; editedMessage?: TelegramMessage; channelPost?: TelegramMessage; } type TelegramUpdateType = "message" | "edited_message" | "channel_post"; declare const telegramCommandBindingSchema: z.ZodObject<{ enabled: z.ZodOptional; scopes: z.ZodOptional>>; }, z.core.$strip>; type TelegramCommandBinding = z.infer; declare const telegramCommandBindingsSchema: z.ZodRecord; scopes: z.ZodOptional>>; }, z.core.$strip>>; type TelegramCommandBindings = z.infer; interface TelegramUserSummary { id: string; username: string | null; firstName: string; lastName: string | null; isBot: boolean; languageCode: string | null; createdAt: Date; updatedAt: Date; } interface TelegramChatSummary { id: string; type: TelegramChatType; title: string | null; username: string | null; isForum: boolean; commandBindings: TelegramCommandBindings | null; createdAt: Date; updatedAt: Date; } interface TelegramChatMemberSummary { id: string; chatId: string; userId: string; status: string; joinedAt: Date | null; leftAt: Date | null; user: TelegramUserSummary | null; createdAt: Date; updatedAt: Date; } interface TelegramMessageSummary { id: string; chatId: string; fromUserId: string | null; senderChatId: string | null; replyToMessageId: string | null; messageType: TelegramUpdateType; text: string | null; attachments: TelegramAttachment[]; payload: unknown | null; sentAt: Date; editedAt: Date | null; commandName: string | null; fromUser: TelegramUserSummary | null; } interface TelegramMessageHookPayload { updateId: number; updateType: TelegramUpdateType; messageId: string; chatId: string; fromUserId: string | null; text: string | null; attachments: TelegramAttachment[]; commandName: string | null; sentAt: Date; editedAt: Date | null; } interface TelegramCommandHookPayload { updateId: number; messageId: string; chatId: string; fromUserId: string | null; commandName: string; args: string; raw: string; sentAt: Date; } interface TelegramChatMemberHookPayload { updateId: number; chatId: string; userId: string; status: string; joinedAt: Date | null; leftAt: Date | null; } type TelegramOutgoingHookAction = "sendMessage" | "editMessageText"; type TelegramOutgoingHookPayload = { action: TelegramOutgoingHookAction; payload: Record; }; type TelegramHooks = { onMessageReceived?: (payload: TelegramMessageHookPayload) => Promise | void; onCommandMatched?: (payload: TelegramCommandHookPayload) => Promise | void; onChatMemberUpdated?: (payload: TelegramChatMemberHookPayload) => Promise | void; }; type TelegramInternalHookPayload = { update: TelegramUpdate; }; type TelegramHooksMap = { internalProcessUpdate: HookFn; internalOutgoingMessage: HookFn; onMessageReceived: HookFn; onCommandMatched: HookFn; onChatMemberUpdated: HookFn; }; type TelegramApiResult = { ok: true; result: T; } | { ok: false; errorCode?: number; description?: string; }; interface TelegramApi { call(method: string, payload: Record): Promise>; sendMessage(payload: Record): Promise>; editMessageText(payload: Record): Promise>; sendChatAction(payload: Record): Promise>; } type TelegramQueuedResult = { ok: true; queued: true; } | { ok: false; errorCode?: number; description?: string; }; type TelegramCommandApiResult = TelegramApiResult | TelegramQueuedResult; interface TelegramCommandApi { call(method: string, payload: Record): Promise>; sendMessage(payload: Record): Promise; editMessageText(payload: Record): Promise; sendChatAction(payload: Record): Promise>; } interface TelegramCommandContext { updateId: number; idempotencyKey: string; update: TelegramUpdate; message: TelegramMessage; chat: TelegramChatSummary; fromUser: TelegramUserSummary | null; command: { name: string; args: string; raw: string; }; api: TelegramCommandApi; handlerTx: HookHandlerTx; } type TelegramCommandHandler = (ctx: TelegramCommandContext) => Promise | void; interface TelegramCommandDefinition { name: string; description?: string; scopes?: TelegramCommandScope[]; handler: TelegramCommandHandler; } type TelegramCommandRegistry = Record; interface TelegramFragmentConfig { botToken: string; webhookSecretToken: string; botUsername?: string; apiBaseUrl?: string; commands?: TelegramCommandRegistry; hooks?: TelegramHooks; } type TelegramConfigBuilder = { command: (command: TelegramCommandDefinition) => TelegramConfigBuilder; build: (overrides?: Partial) => TelegramFragmentConfig; }; declare function defineCommand(name: string, definition: Omit): TelegramCommandDefinition; declare function createTelegram(baseConfig?: Partial): TelegramConfigBuilder; //#endregion export { TelegramApi, TelegramApiResult, TelegramAttachment, TelegramAttachmentKind, TelegramAttachmentPhotoSize, TelegramChatMemberHookPayload, TelegramChatMemberSummary, TelegramChatSummary, TelegramChatType, TelegramCommandApi, TelegramCommandApiResult, TelegramCommandBinding, TelegramCommandBindings, TelegramCommandContext, TelegramCommandDefinition, TelegramCommandRegistry, TelegramCommandScope, TelegramConfigBuilder, TelegramFragmentConfig, TelegramHooks, TelegramHooksMap, TelegramMessage, TelegramMessageHookPayload, TelegramMessageSummary, TelegramQueuedResult, TelegramUpdate, TelegramUpdateType, TelegramUser, TelegramUserSummary, createTelegram, defineCommand, telegramAttachmentKindSchema, telegramAttachmentSchema }; //# sourceMappingURL=types.d.ts.map