import { TelegramClient } from "telegram"; import { Api } from "telegram/tl/index.js"; import type { AllStoriesSummary, BoostsListSummary, BoostsStatusSummary, BroadcastStatsSummary, BusinessChatLinksSummary, ChannelDifferenceSummary, ChatPermissions, DiscussionMessageSummary, EmojiStatusSummary, GroupCallParticipantsSummary, GroupCallSummary, GroupsForDiscussionSummary, MegagroupStatsSummary, MessageButtonDescriptor, MyBoostsSummary, PeerStoriesSummary, PollSummary, QuickRepliesSummary, QuickReplyMessagesSummary, ReadParticipantsSummary, ReportResultSummary, ResolvedBusinessChatLinkSummary, StarsStatusSummary, StoriesByIdSummary, StoryPrivacy, StoryViewsListSummary, UpdatesDifferenceSummary } from "./telegram-helpers.js"; export type { AllStoriesSummary, BoostSummary, BoostsListSummary, BoostsStatusSummary, BroadcastStatsSummary, BusinessChatLinkSummary, BusinessChatLinksSummary, ChannelDifferenceSummary, ChatPermissions, CompactPeer, CompactStatsGraph, DiscussionMessageSummary, EmojiStatusSummary, GroupCallInfoSummary, GroupCallParticipantSummary, GroupCallParticipantsSummary, GroupCallSummary, GroupsForDiscussionSummary, MegagroupStatsSummary, MessageButtonDescriptor, MyBoostSummary, MyBoostsSummary, PeerStoriesSummary, PeerSummary, PollSummary, PrepaidGiveawaySummary, QuickRepliesSummary, QuickReplyMessageSummary, QuickReplyMessagesSummary, QuickReplySummary, ReadParticipantsSummary, ReportResultSummary, ResolvedBusinessChatLinkSummary, StarsAmountSummary, StarsStatusSummary, StarsSubscriptionPricingSummary, StarsSubscriptionSummary, StarsTransactionPeerSummary, StarsTransactionSummary, StatsValue, StoriesByIdSummary, StoryItemSummary, StoryPrivacy, StoryViewSummary, StoryViewsListSummary, UpdatesDifferenceSummary, UpdatesMessageSummary, } from "./telegram-helpers.js"; export { buildStoryPrivacyRules, describeAdminLogAction, describeAdminLogDetails, describeKeyboardButton, detectMediaType, extractPeerId, extractPollMediaFromUpdates, extractStoryIdFromUpdates, mergeBannedRights, peerToCompact, reactionToEmoji, summarizeAllStories, summarizeBoost, summarizeBoostsList, summarizeBoostsStatus, summarizeBroadcastStats, summarizeBusinessChatLink, summarizeBusinessChatLinks, summarizeChannelDifference, summarizeDiscussionMessage, summarizeEmojiStatus, summarizeGroupCall, summarizeGroupCallInfo, summarizeGroupCallParticipant, summarizeGroupCallParticipants, summarizeGroupsForDiscussion, summarizeMegagroupStats, summarizeMyBoost, summarizeMyBoosts, summarizePeer, summarizePeerStories, summarizePoll, summarizePrepaidGiveaway, summarizeQuickReplies, summarizeQuickReply, summarizeQuickReplyMessage, summarizeQuickReplyMessages, summarizeReadParticipants, summarizeReportResult, summarizeStarsAmount, summarizeStarsStatus, summarizeStarsSubscription, summarizeStarsTransaction, summarizeStarsTransactionPeer, summarizeStoriesById, summarizeStoryItem, summarizeStoryView, summarizeStoryViewsList, summarizeUpdatesDifference, } from "./telegram-helpers.js"; /** Minimal client surface the 2FA SRP step needs — lets us unit-test the * branch logic with a stub instead of a live TelegramClient. */ interface SrpClient { invoke(request: unknown): Promise; } /** The SRP digest function (GetPassword response + plaintext → InputCheckPasswordSRP). * Injectable so tests can exercise the orchestration without GramJS's real crypto. */ type ComputeCheckFn = (request: Api.account.Password, password: string) => Promise; /** * Complete a QR login that Telegram answered with SESSION_PASSWORD_NEEDED by * running the SRP cloud-password check: GetPassword → computeCheck → CheckPassword. * * Returns a discriminated outcome rather than throwing so the caller owns * connection teardown. The password is only used to answer the SRP challenge * and is never logged or persisted. * * `compute` is injectable for tests; production always uses GramJS `computeCheck`. */ export declare function completeTwoFactorLogin(client: SrpClient, password: string | undefined, compute?: ComputeCheckFn): Promise<{ ok: true; } | { ok: false; message: string; }>; export type ChatEntity = Api.User | Api.Chat | Api.Channel | Api.TypeUser | Api.TypeChat; export declare class TelegramService { private client; private apiId; private apiHash; private sessionString; private connected; private sessionPath; private rateLimiter; private lastTypingAt; private entityCache; lastError: string; get sessionDir(): string; hasLocalSession(): boolean; getClient(): TelegramClient | null; constructor(apiId: number, apiHash: string, options?: { sessionPath?: string; }); loadSession(): Promise; private isValidSessionString; /** Set session string in memory (for programmatic / hosted use) */ setSessionString(session: string): void; /** Get the current session string (for external persistence) */ getSessionString(): string; private saveSession; connect(): Promise; clearSession(): Promise; /** Ensure connection is active, auto-reconnect if session exists */ ensureConnected(): Promise; disconnect(): Promise; /** * Terminates the session on Telegram servers, destroys the client, and clears * local session (in-memory + file). Returns true only when server-side revoke * confirmed. False means server revoke could not be confirmed — local wipe * was still attempted. Throws if local file removal failed so callers can * surface the partial state instead of silently misreporting success. */ logOut(): Promise; isConnected(): boolean; startQrLogin(onQrDataUrl: (dataUrl: string) => void, onQrUrl?: (url: string) => void, signal?: AbortSignal): Promise<{ success: boolean; message: string; }>; getMe(): Promise<{ id: string; username?: string; firstName?: string; }>; sendMessage(chatId: string, text: string, replyTo?: number, parseMode?: "md" | "html", topicId?: number, extra?: { quoteText?: string; effect?: string; }): Promise; sendFile(chatId: string, filePath: string, caption?: string): Promise; sendVoice(chatId: string, filePath: string, opts?: { caption?: string; replyTo?: number; topicId?: number; parseMode?: "md" | "html"; }): Promise<{ id: number; }>; sendVideoNote(chatId: string, filePath: string, opts?: { duration?: number; length?: number; replyTo?: number; topicId?: number; }): Promise<{ id: number; }>; sendContact(chatId: string, phone: string, firstName: string, opts?: { lastName?: string; vcard?: string; replyTo?: number; topicId?: number; }): Promise<{ id: number; }>; sendDice(chatId: string, emoji: string, opts?: { replyTo?: number; topicId?: number; }): Promise<{ id: number; value?: number; }>; sendLocation(chatId: string, latitude: number, longitude: number, opts?: { accuracyRadius?: number; livePeriod?: number; heading?: number; proximityRadius?: number; replyTo?: number; topicId?: number; }): Promise<{ id: number; }>; sendVenue(chatId: string, latitude: number, longitude: number, title: string, address: string, opts?: { provider?: string; venueId?: string; venueType?: string; replyTo?: number; topicId?: number; }): Promise<{ id: number; }>; sendAlbum(chatId: string, items: Array<{ filePath: string; caption?: string; }>, opts?: { caption?: string; parseMode?: "md" | "html"; replyTo?: number; topicId?: number; }): Promise<{ ids: number[]; }>; downloadMedia(chatId: string, messageId: number, downloadPath: string): Promise; /** * Download a message's media into memory. * * When `options.thumb` is given, GramJS fetches that thumbnail size instead of * the full file (`0` = smallest, larger indexes = bigger previews). This keeps * payloads tiny — useful for callers that inline the bytes and pay per byte * (e.g. base64 in an LLM context). If the message has no thumbnail at that * index, GramJS returns an empty/`undefined` buffer; we transparently fall * back to the full file so the caller always gets bytes. `isThumb` reports * which one was served. * * Note: GramJS signals "no bytes" inconsistently — `undefined` for a missing * thumbnail, but `Buffer.alloc(0)` for undownloadable media (geo/poll/dice, * documents without a file, and several failure paths). An empty Buffer is * truthy, so we guard on `.length`, not truthiness, in both the fallback and * the final failure check — otherwise a 0-byte buffer would be returned as a * "successful" (but garbage) download. */ downloadMediaAsBuffer(chatId: string, messageId: number, options?: { thumb?: number; }): Promise<{ buffer: Buffer; mimeType: string; isThumb: boolean; }>; /** Detect MIME type from buffer magic bytes, falling back to media metadata */ private detectMimeType; pinMessage(chatId: string, messageId: number, silent?: boolean): Promise; unpinMessage(chatId: string, messageId: number): Promise; getDialogs(limit?: number, offsetDate?: number, filterType?: "private" | "group" | "channel" | "contact_requests"): Promise>; getUnreadDialogs(limit?: number): Promise; }>>; getContactRequests(limit?: number): Promise>; addContact(userId: string, firstName: string, lastName?: string, phone?: string): Promise; blockUser(userId: string): Promise; reportSpam(chatId: string): Promise; markAsRead(chatId: string): Promise; getMessageById(chatId: string, messageId: number): Promise<{ id: number; text: string; sender: string; date: string; media?: { type: string; fileName?: string; size?: number; }; reactions?: { emoji: string; count: number; me: boolean; }[]; } | null>; forwardMessage(fromChatId: string, toChatId: string, messageIds: number[]): Promise; editMessage(chatId: string, messageId: number, newText: string): Promise; deleteMessages(chatId: string, messageIds: number[]): Promise; getScheduledMessages(chatId: string): Promise>; deleteScheduledMessages(chatId: string, messageIds: number[]): Promise; getReplies(chatId: string, messageId: number, limit?: number): Promise>; getMessageLink(chatId: string, messageId: number, thread?: boolean): Promise; getUnreadMentions(chatId: string, limit?: number): Promise>; getUnreadReactions(chatId: string, limit?: number): Promise>; translateText(chatId: string, messageIds: number[], toLang: string): Promise; sendTyping(chatId: string, action?: "typing" | "upload_photo" | "upload_document" | "cancel"): Promise; /** * Resolve a chat by ID, username, or display name. * Falls back to searching user's dialogs if getEntity() fails. */ resolveChat(chatId: string): Promise; /** * Resolve chatId to a peer string that GramJS methods accept. * Handles display names by searching dialogs. */ private resolvePeer; /** * Resolve a bare numeric ID to a cached/dialog entity so GramJS can build a * valid InputPeer. Falls back to the raw ID string if no dialog matches — * GramJS may still resolve it (e.g. a contact or a peer it has messaged), * and we must not regress that path. */ private resolveNumericPeer; getChatInfo(chatId: string): Promise<{ id: string; name: string; type: string; username?: string; description?: string; membersCount?: number; isBot?: boolean; isContact?: boolean; forum?: boolean; }>; /** Extract media info from a message */ private extractMediaInfo; /** Resolve sender ID to a display name */ private resolveSenderName; getMessages(chatId: string, limit?: number, offsetId?: number, minDate?: number, maxDate?: number): Promise>; searchChats(query: string, limit?: number): Promise>; searchGlobal(query: string, limit?: number, minDate?: number, maxDate?: number): Promise>; searchMessages(chatId: string, query: string, limit?: number, minDate?: number, maxDate?: number): Promise>; getContacts(limit?: number): Promise>; getChatMembers(chatId: string, limit?: number): Promise>; getMyRole(chatId: string): Promise<{ role: string; chatId: string; chatName: string; }>; private getParticipantUserId; private getParticipantRole; getProfile(userId: string): Promise<{ id: string; name: string; username?: string; phone?: string; bio?: string; photo: boolean; lastSeen?: string; premium?: boolean; birthday?: string; commonChatsCount?: number; personalChannelId?: string; businessWorkHours?: string; businessLocation?: string; }>; downloadProfilePhoto(entityId: string, options?: { isBig?: boolean; savePath?: string; }): Promise<{ buffer: Buffer; mimeType: string; } | { filePath: string; } | null>; /** Detect MIME type from buffer magic bytes */ private detectMimeFromBuffer; /** Extract reactions from a message into a simple format */ private extractReactions; sendReaction(chatId: string, messageId: number, emoji?: string | string[], addToExisting?: boolean): Promise<{ emoji: string; count: number; me: boolean; }[] | undefined>; getMessageReactions(chatId: string, messageId: number): Promise<{ reactions: { emoji: string; count: number; users: { id: string; name: string; }[]; }[]; total: number; }>; setDefaultReaction(emoji: string): Promise; getTopReactions(limit: number): Promise>; getRecentReactions(limit: number): Promise>; sendScheduledMessage(chatId: string, text: string, scheduleDate: number, replyTo?: number, parseMode?: "md" | "html"): Promise; createPoll(chatId: string, question: string, answers: string[], options?: { multipleChoice?: boolean; quiz?: boolean; correctAnswer?: number; }): Promise; sendPollVote(chatId: string, messageId: number, optionIndexes: number[]): Promise<{ totalVoters: number; chosenLabels: string[]; isRetracted: boolean; }>; getPollResults(chatId: string, messageId: number): Promise; getPollVoters(chatId: string, messageId: number, opts?: { optionIndex?: number; limit?: number; offset?: string; }): Promise<{ total: number; nextOffset?: string; voters: Array<{ peerId: string; name?: string; username?: string; options: string[]; date: number; }>; }>; closePoll(chatId: string, messageId: number): Promise<{ totalVoters: number; }>; transcribeAudio(chatId: string, messageId: number): Promise<{ transcriptionId: string; text: string; pending: boolean; trialRemainsNum?: number; trialRemainsUntilDate?: number; }>; rateTranscription(chatId: string, messageId: number, transcriptionId: string, good: boolean): Promise; getFactCheck(chatId: string, messageIds: number[]): Promise>; editFactCheck(chatId: string, messageId: number, text: string, _opts?: { parseMode?: "md" | "html"; }): Promise; deleteFactCheck(chatId: string, messageId: number): Promise; sendPaidReaction(chatId: string, messageId: number, count: number, opts?: { private?: boolean; }): Promise<{ count: number; }>; togglePaidReactionPrivacy(chatId: string, messageId: number, privateFlag: boolean): Promise; getPaidReactionPrivacy(): Promise<{ private: boolean; }>; getForumTopics(chatId: string, limit?: number): Promise>; getTopicMessages(chatId: string, topicId: number, limit?: number, offsetId?: number): Promise>; /** Check if a chat entity is a forum (has topics enabled) */ isForum(chatId: string): Promise; joinChat(target: string): Promise<{ id: string; title: string; type: string; }>; createGroup(options: { title: string; users: string[]; supergroup?: boolean; forum?: boolean; description?: string; }): Promise<{ id: string; title: string; type: string; inviteLink?: string; }>; inviteToGroup(chatId: string, users: string[]): Promise<{ invited: string[]; failed: string[]; }>; kickUser(chatId: string, userId: string): Promise; banUser(chatId: string, userId: string): Promise; unbanUser(chatId: string, userId: string): Promise; editGroup(chatId: string, options: { title?: string; description?: string; photoPath?: string; }): Promise; leaveGroup(chatId: string): Promise; setAdmin(chatId: string, userId: string, options?: { title?: string; }): Promise; removeAdmin(chatId: string, userId: string): Promise; unblockUser(userId: string): Promise; muteChat(chatId: string, muteUntil: number): Promise; archiveChat(chatId: string, archive: boolean): Promise; pinDialog(chatId: string, pin: boolean): Promise; markDialogUnread(chatId: string, unread: boolean): Promise; getAdminLog(chatId: string, limit?: number, q?: string): Promise>; setChatPermissions(chatId: string, permissions: ChatPermissions): Promise; setSlowMode(chatId: string, seconds: number): Promise; toggleChannelSignatures(chatId: string, enabled: boolean): Promise; toggleAntiSpam(chatId: string, enabled: boolean): Promise; toggleForumMode(chatId: string, enabled: boolean): Promise; togglePrehistoryHidden(chatId: string, hidden: boolean): Promise; setChatAvailableReactions(chatId: string, reactions: { type: "all"; allowCustom?: boolean; } | { type: "some"; emoji: string[]; } | { type: "none"; }): Promise; approveChatJoinRequest(chatId: string, userId: string, approved: boolean): Promise; getInlineBotResults(bot: string, chatId: string, query: string, offset?: string): Promise<{ queryId: string; nextOffset?: string; cacheTime: number; gallery: boolean; results: Array<{ id: string; type: string; title?: string; description?: string; url?: string; }>; }>; sendInlineBotResult(chatId: string, queryId: string, resultId: string, options?: { replyTo?: number; silent?: boolean; hideVia?: boolean; clearDraft?: boolean; }): Promise<{ messageId: number; }>; pressButton(chatId: string, messageId: number, options: { buttonIndex?: { row: number; column: number; }; data?: string; }): Promise<{ alert?: boolean; hasUrl?: boolean; nativeUi?: boolean; message?: string; url?: string; cacheTime: number; }>; getMessageButtons(chatId: string, messageId: number): Promise<{ markupType: string; buttons: MessageButtonDescriptor[]; }>; getBroadcastStats(chatId: string, options?: { dark?: boolean; includeGraphs?: boolean; }): Promise; getMegagroupStats(chatId: string, options?: { dark?: boolean; includeGraphs?: boolean; }): Promise; getUpdatesState(): Promise<{ pts: number; qts: number; date: number; seq: number; unreadCount: number; }>; getUpdates(cursor: { pts: number; date: number; qts: number; ptsLimit?: number; ptsTotalLimit?: number; }): Promise; getChannelUpdates(chatId: string, cursor: { pts: number; limit?: number; force?: boolean; }): Promise; createForumTopic(chatId: string, title: string, iconColor?: number, iconEmojiId?: string): Promise<{ id: number; title: string; }>; editForumTopic(chatId: string, topicId: number, options: { title?: string; iconEmojiId?: string; closed?: boolean; hidden?: boolean; }): Promise; deleteForumTopic(chatId: string, topicId: number): Promise; exportInviteLink(chatId: string, options?: { expireDate?: number; usageLimit?: number; requestNeeded?: boolean; title?: string; }): Promise; getInviteLinks(chatId: string, limit?: number, adminId?: string): Promise>; revokeInviteLink(chatId: string, link: string): Promise; getChatFolders(): Promise>; setAutoDelete(chatId: string, period: number): Promise; createFolder(opts: { title: string; emoticon?: string; contacts?: boolean; nonContacts?: boolean; groups?: boolean; broadcasts?: boolean; bots?: boolean; excludeMuted?: boolean; excludeRead?: boolean; excludeArchived?: boolean; includePeers?: string[]; excludePeers?: string[]; pinnedPeers?: string[]; }): Promise; editFolder(id: number, opts: { title?: string; emoticon?: string; contacts?: boolean; nonContacts?: boolean; groups?: boolean; broadcasts?: boolean; bots?: boolean; excludeMuted?: boolean; excludeRead?: boolean; excludeArchived?: boolean; includePeers?: string[]; excludePeers?: string[]; pinnedPeers?: string[]; }): Promise; deleteFolder(id: number): Promise; reorderFolders(ids: number[]): Promise; getSuggestedFolders(): Promise>; toggleDialogFilterTags(enabled: boolean): Promise; getGlobalPrivacySettings(): Promise<{ archiveAndMuteNewNoncontactPeers: boolean; keepArchivedUnmuted: boolean; keepArchivedFolders: boolean; hideReadMarks: boolean; newNoncontactPeersRequirePremium: boolean; }>; setGlobalPrivacySettings(opts: { archiveAndMuteNewNoncontactPeers?: boolean; keepArchivedUnmuted?: boolean; keepArchivedFolders?: boolean; hideReadMarks?: boolean; newNoncontactPeersRequirePremium?: boolean; }): Promise; getActiveSessions(): Promise>; terminateSession(hash: string): Promise; terminateAllOtherSessions(): Promise; private static PRIVACY_KEYS; setPrivacy(setting: string, rule: "everyone" | "contacts" | "nobody", allowUsers?: string[], disallowUsers?: string[]): Promise; updateProfile(options: { firstName?: string; lastName?: string; bio?: string; }): Promise; updateUsername(username: string): Promise; getStickerSet(shortName: string): Promise<{ title: string; shortName: string; count: number; stickers: Array<{ id: string; accessHash: string; emoji: string; }>; }>; searchStickerSets(query: string): Promise>; getInstalledStickerSets(): Promise>; sendSticker(chatId: string, stickerSetShortName: string, stickerIndex: number, replyTo?: number): Promise; saveDraft(chatId: string, text: string, replyTo?: number): Promise; getAllDrafts(): Promise>; clearAllDrafts(): Promise; getSavedDialogs(limit: number): Promise>; getWebPreview(url: string): Promise<{ type: string; url?: string; title?: string; description?: string; siteName?: string; } | null>; getRecentStickers(): Promise>; getAllStories(options?: { next?: boolean; hidden?: boolean; state?: string; }): Promise; getPeerStories(chatId: string): Promise; getStoriesById(chatId: string, ids: number[]): Promise; getStoryViewsList(chatId: string, options: { id: number; q?: string; justContacts?: boolean; reactionsFirst?: boolean; forwardsFirst?: boolean; offset?: string; limit?: number; }): Promise; getMyBoosts(): Promise; getBoostsStatus(chatId: string): Promise; getBoostsList(chatId: string, options?: { gifts?: boolean; offset?: string; limit?: number; }): Promise; getBusinessChatLinks(): Promise; setEmojiStatus(opts: { documentId?: string; collectibleId?: string; untilUnix?: number; }): Promise; listEmojiStatuses(kind: "default" | "recent" | "channel_default" | "collectible", limit: number): Promise; clearRecentEmojiStatuses(): Promise; setProfileColor(opts: { forProfile: boolean; color?: number; backgroundEmojiId?: string; }): Promise; setBirthday(opts: { day?: number; month?: number; year?: number; clear?: boolean; }): Promise; setPersonalChannel(opts: { channelId?: string; clear?: boolean; }): Promise; setProfilePhoto(opts: { filePath: string; isVideo: boolean; videoStartTs?: number; fallback: boolean; }): Promise<{ id: string; }>; deleteProfilePhotos(photoIds: string[]): Promise<{ deleted: string[]; missing: string[]; }>; private buildBusinessRecipients; private resolveInputUsers; private parseEntities; setBusinessWorkHours(opts: { timezone?: string; openNow?: boolean; schedule?: Array<{ day: string; openFrom: string; openTo: string; }>; clear?: boolean; }): Promise; setBusinessLocation(opts: { address?: string; latitude?: number; longitude?: number; clear?: boolean; }): Promise; setBusinessGreeting(opts: { shortcutId?: number; audience: "all_new" | "contacts_only" | "non_contacts" | "existing_only"; includeUsers?: string[]; excludeUsers?: string[]; noActivityDays: number; clear?: boolean; }): Promise; setBusinessAway(opts: { shortcutId?: number; schedule: "always" | "outside_hours" | "custom"; customFrom?: number; customTo?: number; offlineOnly: boolean; audience: "all_new" | "contacts_only" | "non_contacts" | "existing_only"; includeUsers?: string[]; excludeUsers?: string[]; clear?: boolean; }): Promise; setBusinessIntro(opts: { title?: string; description?: string; stickerId?: string; stickerAccessHash?: string; stickerFileReference?: string; clear?: boolean; }): Promise; createBusinessChatLink(opts: { message: string; title?: string; parseMode?: "md" | "html"; }): Promise; editBusinessChatLink(opts: { slug: string; message: string; title?: string; parseMode?: "md" | "html"; }): Promise; deleteBusinessChatLink(slug: string): Promise; resolveBusinessChatLink(slug: string): Promise; getGroupCall(chatId: string, options?: { limit?: number; }): Promise; getGroupCallParticipants(chatId: string, options?: { ids?: string[]; sources?: number[]; offset?: string; limit?: number; }): Promise; getStarsStatus(chatId: string): Promise; getStarsTransactions(chatId: string, options?: { inbound?: boolean; outbound?: boolean; ascending?: boolean; subscriptionId?: string; offset?: string; limit?: number; }): Promise; getAvailableStarGifts(): Promise>; getSavedStarGifts(chatId: string, opts?: { limit?: number; offset?: string; excludeUnsaved?: boolean; excludeSaved?: boolean; excludeUnlimited?: boolean; excludeLimited?: boolean; excludeUnique?: boolean; sortByValue?: boolean; }): Promise<{ count: number; nextOffset?: string; gifts: Array<{ giftId: string; giftKind: "regular" | "unique"; giftTitle?: string; stars?: string; convertStars?: string; msgId?: number; savedId?: string; fromPeerId?: string; date: number; unsaved: boolean; canUpgrade: boolean; upgradeStars?: string; }>; }>; saveStarGift(opts: { msgId?: number; chatId?: string; savedId?: string; unsave?: boolean; }): Promise; convertStarGift(opts: { msgId?: number; chatId?: string; savedId?: string; }): Promise; getStarsTopupOptions(): Promise>; getStarsSubscriptions(chatId: string, opts?: { offset?: string; missingBalance?: boolean; }): Promise<{ subscriptions: Array<{ id: string; peerId: string; untilDate: number; periodSeconds: number; priceStars: string; canceled: boolean; title?: string; }>; nextOffset?: string; }>; changeStarsSubscription(chatId: string, subscriptionId: string, canceled: boolean): Promise; getQuickReplies(hash?: string): Promise; getQuickReplyMessages(shortcutId: number, options?: { ids?: number[]; hash?: string; }): Promise; sendStory(chatId: string, filePath: string, opts: { type?: "photo" | "video"; caption?: string; parseMode?: "md" | "html"; privacy: StoryPrivacy; allowUserIds?: string[]; disallowUserIds?: string[]; period?: number; pinned?: boolean; noforwards?: boolean; }): Promise<{ id: number | undefined; period: number; }>; editStory(chatId: string, storyId: number, opts: { filePath?: string; type?: "photo" | "video"; caption?: string; parseMode?: "md" | "html"; privacy?: StoryPrivacy; allowUserIds?: string[]; disallowUserIds?: string[]; }): Promise<{ changed: string[]; }>; deleteStories(chatId: string, ids: number[]): Promise<{ deleted: number[]; }>; sendStoryReaction(chatId: string, storyId: number, emoji: string, addToRecent?: boolean): Promise; exportStoryLink(chatId: string, storyId: number): Promise<{ link: string; }>; readStories(chatId: string, maxId: number): Promise<{ ids: number[]; }>; toggleStoryPinned(chatId: string, ids: number[], pinned: boolean): Promise<{ affected: number[]; }>; toggleStoryPinnedToTop(chatId: string, ids: number[]): Promise<{ ok: boolean; }>; activateStealthMode(past?: boolean, future?: boolean): Promise; getStoriesArchive(chatId: string, offsetId: number, limit: number): Promise; reportStory(chatId: string, ids: number[], option: string, message: string): Promise; getDiscussionMessage(chatId: string, messageId: number): Promise; getGroupsForDiscussion(): Promise; getMessageReadParticipants(chatId: string, messageId: number): Promise; getOutboxReadDate(chatId: string, messageId: number): Promise<{ readAt: string | null; }>; private resolveInputGroupCall; }