@overpod/mcp-telegram 1.24.1 → 1.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +67 -1
- package/README.md +45 -13
- package/dist/__tests__/admin-log.test.d.ts +1 -0
- package/dist/__tests__/admin-log.test.js +41 -0
- package/dist/__tests__/approve-join-request.test.d.ts +1 -0
- package/dist/__tests__/approve-join-request.test.js +107 -0
- package/dist/__tests__/boosts.test.d.ts +1 -0
- package/dist/__tests__/boosts.test.js +310 -0
- package/dist/__tests__/broadcast-stats.test.d.ts +1 -0
- package/dist/__tests__/broadcast-stats.test.js +172 -0
- package/dist/__tests__/business-chat-links.test.d.ts +1 -0
- package/dist/__tests__/business-chat-links.test.js +102 -0
- package/dist/__tests__/get-message-buttons.test.d.ts +1 -0
- package/dist/__tests__/get-message-buttons.test.js +122 -0
- package/dist/__tests__/group-calls.test.d.ts +1 -0
- package/dist/__tests__/group-calls.test.js +503 -0
- package/dist/__tests__/inline-query-send.test.d.ts +1 -0
- package/dist/__tests__/inline-query-send.test.js +94 -0
- package/dist/__tests__/inline-query.test.d.ts +1 -0
- package/dist/__tests__/inline-query.test.js +115 -0
- package/dist/__tests__/megagroup-stats.test.d.ts +1 -0
- package/dist/__tests__/megagroup-stats.test.js +166 -0
- package/dist/__tests__/press-button.test.d.ts +1 -0
- package/dist/__tests__/press-button.test.js +123 -0
- package/dist/__tests__/quick-replies.test.d.ts +1 -0
- package/dist/__tests__/quick-replies.test.js +245 -0
- package/dist/__tests__/reactions.test.d.ts +1 -0
- package/dist/__tests__/reactions.test.js +23 -0
- package/dist/__tests__/set-chat-permissions-merge.test.d.ts +1 -0
- package/dist/__tests__/set-chat-permissions-merge.test.js +107 -0
- package/dist/__tests__/set-chat-reactions.test.d.ts +1 -0
- package/dist/__tests__/set-chat-reactions.test.js +129 -0
- package/dist/__tests__/stars-status.test.d.ts +1 -0
- package/dist/__tests__/stars-status.test.js +205 -0
- package/dist/__tests__/stars-transactions.test.d.ts +1 -0
- package/dist/__tests__/stars-transactions.test.js +82 -0
- package/dist/__tests__/stories.test.d.ts +1 -0
- package/dist/__tests__/stories.test.js +361 -0
- package/dist/__tests__/toggle-anti-spam.test.d.ts +1 -0
- package/dist/__tests__/toggle-anti-spam.test.js +80 -0
- package/dist/__tests__/toggle-channel-signatures.test.d.ts +1 -0
- package/dist/__tests__/toggle-channel-signatures.test.js +80 -0
- package/dist/__tests__/toggle-forum-mode.test.d.ts +1 -0
- package/dist/__tests__/toggle-forum-mode.test.js +80 -0
- package/dist/__tests__/toggle-prehistory-hidden.test.d.ts +1 -0
- package/dist/__tests__/toggle-prehistory-hidden.test.js +80 -0
- package/dist/__tests__/updates.test.d.ts +1 -0
- package/dist/__tests__/updates.test.js +221 -0
- package/dist/rate-limiter.d.ts +8 -2
- package/dist/rate-limiter.js +15 -8
- package/dist/telegram-client.d.ts +711 -2
- package/dist/telegram-client.js +2167 -99
- package/dist/tools/account.js +108 -0
- package/dist/tools/boosts.d.ts +3 -0
- package/dist/tools/boosts.js +65 -0
- package/dist/tools/chats.js +388 -1
- package/dist/tools/group-calls.d.ts +4 -0
- package/dist/tools/group-calls.js +77 -0
- package/dist/tools/index.js +10 -0
- package/dist/tools/media.js +120 -1
- package/dist/tools/messages.js +379 -0
- package/dist/tools/quick-replies.d.ts +4 -0
- package/dist/tools/quick-replies.js +58 -0
- package/dist/tools/reactions.js +102 -1
- package/dist/tools/stars.d.ts +4 -0
- package/dist/tools/stars.js +71 -0
- package/dist/tools/stories.d.ts +3 -0
- package/dist/tools/stories.js +107 -0
- package/package.json +1 -1
|
@@ -1,5 +1,474 @@
|
|
|
1
|
+
import bigInt from "big-integer";
|
|
1
2
|
import { TelegramClient } from "telegram";
|
|
2
3
|
import { Api } from "telegram/tl/index.js";
|
|
4
|
+
export declare function describeAdminLogAction(action: Api.TypeChannelAdminLogEventAction): string;
|
|
5
|
+
export declare function describeAdminLogDetails(action: Api.TypeChannelAdminLogEventAction, describeUser: (userId: bigInt.BigInteger) => string): string;
|
|
6
|
+
export declare function reactionToEmoji(reaction: Api.TypeReaction): string | null;
|
|
7
|
+
export type CompactStatsGraph = {
|
|
8
|
+
type: "async";
|
|
9
|
+
token: string;
|
|
10
|
+
} | {
|
|
11
|
+
type: "error";
|
|
12
|
+
error: string;
|
|
13
|
+
} | {
|
|
14
|
+
type: "data";
|
|
15
|
+
data: unknown;
|
|
16
|
+
zoomToken?: string;
|
|
17
|
+
};
|
|
18
|
+
export type StatsValue = {
|
|
19
|
+
current: number;
|
|
20
|
+
previous: number;
|
|
21
|
+
};
|
|
22
|
+
export type BroadcastStatsSummary = {
|
|
23
|
+
period: {
|
|
24
|
+
minDate: number;
|
|
25
|
+
maxDate: number;
|
|
26
|
+
};
|
|
27
|
+
followers: StatsValue;
|
|
28
|
+
viewsPerPost: StatsValue;
|
|
29
|
+
sharesPerPost: StatsValue;
|
|
30
|
+
reactionsPerPost: StatsValue;
|
|
31
|
+
viewsPerStory: StatsValue;
|
|
32
|
+
sharesPerStory: StatsValue;
|
|
33
|
+
reactionsPerStory: StatsValue;
|
|
34
|
+
enabledNotifications: {
|
|
35
|
+
part: number;
|
|
36
|
+
total: number;
|
|
37
|
+
percent: number;
|
|
38
|
+
};
|
|
39
|
+
recentPostsInteractions: Array<{
|
|
40
|
+
kind: "message";
|
|
41
|
+
msgId: number;
|
|
42
|
+
views: number;
|
|
43
|
+
forwards: number;
|
|
44
|
+
reactions: number;
|
|
45
|
+
} | {
|
|
46
|
+
kind: "story";
|
|
47
|
+
storyId: number;
|
|
48
|
+
views: number;
|
|
49
|
+
forwards: number;
|
|
50
|
+
reactions: number;
|
|
51
|
+
}>;
|
|
52
|
+
graphs?: Record<string, CompactStatsGraph>;
|
|
53
|
+
};
|
|
54
|
+
export type MegagroupStatsSummary = {
|
|
55
|
+
period: {
|
|
56
|
+
minDate: number;
|
|
57
|
+
maxDate: number;
|
|
58
|
+
};
|
|
59
|
+
members: StatsValue;
|
|
60
|
+
messages: StatsValue;
|
|
61
|
+
viewers: StatsValue;
|
|
62
|
+
posters: StatsValue;
|
|
63
|
+
topPosters: Array<{
|
|
64
|
+
userId: string;
|
|
65
|
+
messages: number;
|
|
66
|
+
avgChars: number;
|
|
67
|
+
}>;
|
|
68
|
+
topAdmins: Array<{
|
|
69
|
+
userId: string;
|
|
70
|
+
deleted: number;
|
|
71
|
+
kicked: number;
|
|
72
|
+
banned: number;
|
|
73
|
+
}>;
|
|
74
|
+
topInviters: Array<{
|
|
75
|
+
userId: string;
|
|
76
|
+
invitations: number;
|
|
77
|
+
}>;
|
|
78
|
+
graphs?: Record<string, CompactStatsGraph>;
|
|
79
|
+
};
|
|
80
|
+
export declare function summarizeMegagroupStats(stats: Api.stats.MegagroupStats, includeGraphs: boolean): MegagroupStatsSummary;
|
|
81
|
+
export declare function summarizeBroadcastStats(stats: Api.stats.BroadcastStats, includeGraphs: boolean): BroadcastStatsSummary;
|
|
82
|
+
export type ChatPermissions = {
|
|
83
|
+
sendMessages?: boolean;
|
|
84
|
+
sendMedia?: boolean;
|
|
85
|
+
sendStickers?: boolean;
|
|
86
|
+
sendGifs?: boolean;
|
|
87
|
+
sendPolls?: boolean;
|
|
88
|
+
sendInline?: boolean;
|
|
89
|
+
embedLinks?: boolean;
|
|
90
|
+
changeInfo?: boolean;
|
|
91
|
+
inviteUsers?: boolean;
|
|
92
|
+
pinMessages?: boolean;
|
|
93
|
+
};
|
|
94
|
+
export declare function mergeBannedRights(current: Record<string, unknown> | undefined | null, permissions: ChatPermissions): Record<string, boolean>;
|
|
95
|
+
export type MessageButtonDescriptor = {
|
|
96
|
+
row: number;
|
|
97
|
+
col: number;
|
|
98
|
+
type: string;
|
|
99
|
+
label: string;
|
|
100
|
+
data?: string;
|
|
101
|
+
url?: string;
|
|
102
|
+
switchQuery?: string;
|
|
103
|
+
samePeer?: boolean;
|
|
104
|
+
userId?: string;
|
|
105
|
+
buttonId?: number;
|
|
106
|
+
copyText?: string;
|
|
107
|
+
requiresPassword?: boolean;
|
|
108
|
+
quiz?: boolean;
|
|
109
|
+
};
|
|
110
|
+
export declare function describeKeyboardButton(button: Api.TypeKeyboardButton, row: number, col: number): MessageButtonDescriptor;
|
|
111
|
+
export type CompactPeer = {
|
|
112
|
+
kind: "user";
|
|
113
|
+
id: string;
|
|
114
|
+
} | {
|
|
115
|
+
kind: "chat";
|
|
116
|
+
id: string;
|
|
117
|
+
} | {
|
|
118
|
+
kind: "channel";
|
|
119
|
+
id: string;
|
|
120
|
+
};
|
|
121
|
+
export type UpdatesMessageSummary = {
|
|
122
|
+
id: number;
|
|
123
|
+
peer: CompactPeer;
|
|
124
|
+
fromId?: CompactPeer;
|
|
125
|
+
date: number;
|
|
126
|
+
text: string;
|
|
127
|
+
isService: boolean;
|
|
128
|
+
};
|
|
129
|
+
export type UpdatesDifferenceSummary = {
|
|
130
|
+
state: {
|
|
131
|
+
pts: number;
|
|
132
|
+
qts: number;
|
|
133
|
+
date: number;
|
|
134
|
+
seq: number;
|
|
135
|
+
unreadCount?: number;
|
|
136
|
+
};
|
|
137
|
+
isFinal: boolean;
|
|
138
|
+
newMessages: UpdatesMessageSummary[];
|
|
139
|
+
deletedMessageIds: Array<{
|
|
140
|
+
peer?: CompactPeer;
|
|
141
|
+
messageIds: number[];
|
|
142
|
+
}>;
|
|
143
|
+
otherUpdates: Array<{
|
|
144
|
+
type: string;
|
|
145
|
+
}>;
|
|
146
|
+
fallback?: {
|
|
147
|
+
kind: "tooLong";
|
|
148
|
+
suggestedAction: string;
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
export type ChannelDifferenceSummary = {
|
|
152
|
+
channelId: string;
|
|
153
|
+
pts: number;
|
|
154
|
+
isFinal: boolean;
|
|
155
|
+
timeout?: number;
|
|
156
|
+
newMessages: UpdatesMessageSummary[];
|
|
157
|
+
otherUpdates: Array<{
|
|
158
|
+
type: string;
|
|
159
|
+
}>;
|
|
160
|
+
fallback?: {
|
|
161
|
+
kind: "tooLong";
|
|
162
|
+
suggestedAction: string;
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
export declare function peerToCompact(peer: Api.TypePeer | undefined): CompactPeer | undefined;
|
|
166
|
+
export declare function summarizeUpdatesDifference(diff: Api.updates.TypeDifference, cursor: {
|
|
167
|
+
pts: number;
|
|
168
|
+
qts: number;
|
|
169
|
+
date: number;
|
|
170
|
+
}): UpdatesDifferenceSummary;
|
|
171
|
+
export declare function summarizeChannelDifference(diff: Api.updates.TypeChannelDifference, channelId: string, fallbackPts: number): ChannelDifferenceSummary;
|
|
172
|
+
export type StoryItemSummary = {
|
|
173
|
+
id: number;
|
|
174
|
+
kind: "active" | "deleted" | "skipped";
|
|
175
|
+
date?: number;
|
|
176
|
+
expireDate?: number;
|
|
177
|
+
caption?: string;
|
|
178
|
+
mediaType?: string;
|
|
179
|
+
pinned?: boolean;
|
|
180
|
+
public?: boolean;
|
|
181
|
+
closeFriends?: boolean;
|
|
182
|
+
edited?: boolean;
|
|
183
|
+
noforwards?: boolean;
|
|
184
|
+
fromId?: CompactPeer;
|
|
185
|
+
viewsCount?: number;
|
|
186
|
+
reactionsCount?: number;
|
|
187
|
+
};
|
|
188
|
+
export type PeerStoriesSummary = {
|
|
189
|
+
peer: CompactPeer;
|
|
190
|
+
maxReadId?: number;
|
|
191
|
+
stories: StoryItemSummary[];
|
|
192
|
+
};
|
|
193
|
+
export type AllStoriesSummary = {
|
|
194
|
+
modified: boolean;
|
|
195
|
+
state: string;
|
|
196
|
+
hasMore?: boolean;
|
|
197
|
+
count?: number;
|
|
198
|
+
peerStories: PeerStoriesSummary[];
|
|
199
|
+
stealthMode?: {
|
|
200
|
+
activeUntilDate?: number;
|
|
201
|
+
cooldownUntilDate?: number;
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
export type StoriesByIdSummary = {
|
|
205
|
+
count: number;
|
|
206
|
+
stories: StoryItemSummary[];
|
|
207
|
+
pinnedToTop?: number[];
|
|
208
|
+
};
|
|
209
|
+
export type StoryViewSummary = {
|
|
210
|
+
kind: "user";
|
|
211
|
+
userId: string;
|
|
212
|
+
date: number;
|
|
213
|
+
reaction?: string | null;
|
|
214
|
+
blocked?: boolean;
|
|
215
|
+
blockedMyStoriesFrom?: boolean;
|
|
216
|
+
} | {
|
|
217
|
+
kind: "publicForward";
|
|
218
|
+
messageId?: number;
|
|
219
|
+
peer?: CompactPeer;
|
|
220
|
+
blocked?: boolean;
|
|
221
|
+
blockedMyStoriesFrom?: boolean;
|
|
222
|
+
} | {
|
|
223
|
+
kind: "publicRepost";
|
|
224
|
+
peer?: CompactPeer;
|
|
225
|
+
storyId?: number;
|
|
226
|
+
blocked?: boolean;
|
|
227
|
+
blockedMyStoriesFrom?: boolean;
|
|
228
|
+
};
|
|
229
|
+
export type StoryViewsListSummary = {
|
|
230
|
+
count: number;
|
|
231
|
+
viewsCount: number;
|
|
232
|
+
forwardsCount: number;
|
|
233
|
+
reactionsCount: number;
|
|
234
|
+
views: StoryViewSummary[];
|
|
235
|
+
nextOffset?: string;
|
|
236
|
+
};
|
|
237
|
+
export type MyBoostSummary = {
|
|
238
|
+
slot: number;
|
|
239
|
+
peer?: CompactPeer;
|
|
240
|
+
date: number;
|
|
241
|
+
expires: number;
|
|
242
|
+
cooldownUntilDate?: number;
|
|
243
|
+
};
|
|
244
|
+
export type MyBoostsSummary = {
|
|
245
|
+
count: number;
|
|
246
|
+
myBoosts: MyBoostSummary[];
|
|
247
|
+
};
|
|
248
|
+
export declare function summarizeMyBoost(boost: Api.TypeMyBoost): MyBoostSummary;
|
|
249
|
+
export declare function summarizeMyBoosts(result: Api.premium.TypeMyBoosts): MyBoostsSummary;
|
|
250
|
+
export type PrepaidGiveawaySummary = {
|
|
251
|
+
kind: "premium" | "stars";
|
|
252
|
+
id: string;
|
|
253
|
+
quantity: number;
|
|
254
|
+
date: number;
|
|
255
|
+
months?: number;
|
|
256
|
+
stars?: string;
|
|
257
|
+
boosts?: number;
|
|
258
|
+
};
|
|
259
|
+
export type BoostsStatusSummary = {
|
|
260
|
+
level: number;
|
|
261
|
+
boosts: number;
|
|
262
|
+
currentLevelBoosts: number;
|
|
263
|
+
nextLevelBoosts?: number;
|
|
264
|
+
giftBoosts?: number;
|
|
265
|
+
premiumAudience?: {
|
|
266
|
+
part: number;
|
|
267
|
+
total: number;
|
|
268
|
+
};
|
|
269
|
+
boostUrl: string;
|
|
270
|
+
myBoost?: boolean;
|
|
271
|
+
myBoostSlots?: number[];
|
|
272
|
+
prepaidGiveaways?: PrepaidGiveawaySummary[];
|
|
273
|
+
};
|
|
274
|
+
export declare function summarizePrepaidGiveaway(g: Api.TypePrepaidGiveaway): PrepaidGiveawaySummary;
|
|
275
|
+
export declare function summarizeBoostsStatus(result: Api.premium.TypeBoostsStatus): BoostsStatusSummary;
|
|
276
|
+
export type BoostSummary = {
|
|
277
|
+
id: string;
|
|
278
|
+
userId?: string;
|
|
279
|
+
date: number;
|
|
280
|
+
expires: number;
|
|
281
|
+
gift?: boolean;
|
|
282
|
+
giveaway?: boolean;
|
|
283
|
+
unclaimed?: boolean;
|
|
284
|
+
giveawayMsgId?: number;
|
|
285
|
+
usedGiftSlug?: string;
|
|
286
|
+
multiplier?: number;
|
|
287
|
+
stars?: string;
|
|
288
|
+
};
|
|
289
|
+
export type BoostsListSummary = {
|
|
290
|
+
count: number;
|
|
291
|
+
boosts: BoostSummary[];
|
|
292
|
+
nextOffset?: string;
|
|
293
|
+
};
|
|
294
|
+
export declare function summarizeBoost(boost: Api.TypeBoost): BoostSummary;
|
|
295
|
+
export declare function summarizeBoostsList(result: Api.premium.TypeBoostsList): BoostsListSummary;
|
|
296
|
+
export type BusinessChatLinkSummary = {
|
|
297
|
+
link: string;
|
|
298
|
+
message: string;
|
|
299
|
+
title?: string;
|
|
300
|
+
views: number;
|
|
301
|
+
entityCount: number;
|
|
302
|
+
};
|
|
303
|
+
export type BusinessChatLinksSummary = {
|
|
304
|
+
count: number;
|
|
305
|
+
links: BusinessChatLinkSummary[];
|
|
306
|
+
};
|
|
307
|
+
export declare function summarizeBusinessChatLink(link: Api.TypeBusinessChatLink): BusinessChatLinkSummary;
|
|
308
|
+
export declare function summarizeBusinessChatLinks(result: Api.account.TypeBusinessChatLinks): BusinessChatLinksSummary;
|
|
309
|
+
export type GroupCallInfoSummary = {
|
|
310
|
+
kind: "active";
|
|
311
|
+
id: string;
|
|
312
|
+
accessHash: string;
|
|
313
|
+
participantsCount: number;
|
|
314
|
+
title?: string;
|
|
315
|
+
scheduleDate?: number;
|
|
316
|
+
recordStartDate?: number;
|
|
317
|
+
streamDcId?: number;
|
|
318
|
+
unmutedVideoCount?: number;
|
|
319
|
+
unmutedVideoLimit: number;
|
|
320
|
+
version: number;
|
|
321
|
+
joinMuted?: boolean;
|
|
322
|
+
canChangeJoinMuted?: boolean;
|
|
323
|
+
joinDateAsc?: boolean;
|
|
324
|
+
scheduleStartSubscribed?: boolean;
|
|
325
|
+
canStartVideo?: boolean;
|
|
326
|
+
recordVideoActive?: boolean;
|
|
327
|
+
rtmpStream?: boolean;
|
|
328
|
+
listenersHidden?: boolean;
|
|
329
|
+
} | {
|
|
330
|
+
kind: "discarded";
|
|
331
|
+
id: string;
|
|
332
|
+
accessHash: string;
|
|
333
|
+
duration: number;
|
|
334
|
+
};
|
|
335
|
+
export type GroupCallParticipantSummary = {
|
|
336
|
+
peer: CompactPeer | undefined;
|
|
337
|
+
date: number;
|
|
338
|
+
activeDate?: number;
|
|
339
|
+
source: number;
|
|
340
|
+
volume?: number;
|
|
341
|
+
muted?: boolean;
|
|
342
|
+
left?: boolean;
|
|
343
|
+
canSelfUnmute?: boolean;
|
|
344
|
+
justJoined?: boolean;
|
|
345
|
+
self?: boolean;
|
|
346
|
+
mutedByYou?: boolean;
|
|
347
|
+
volumeByAdmin?: boolean;
|
|
348
|
+
videoJoined?: boolean;
|
|
349
|
+
about?: string;
|
|
350
|
+
raiseHandRating?: string;
|
|
351
|
+
hasVideo?: boolean;
|
|
352
|
+
hasPresentation?: boolean;
|
|
353
|
+
};
|
|
354
|
+
export type GroupCallSummary = {
|
|
355
|
+
call: GroupCallInfoSummary;
|
|
356
|
+
participants: GroupCallParticipantSummary[];
|
|
357
|
+
participantsNextOffset?: string;
|
|
358
|
+
};
|
|
359
|
+
export type GroupCallParticipantsSummary = {
|
|
360
|
+
count: number;
|
|
361
|
+
participants: GroupCallParticipantSummary[];
|
|
362
|
+
nextOffset?: string;
|
|
363
|
+
version: number;
|
|
364
|
+
};
|
|
365
|
+
export declare function summarizeGroupCallInfo(call: Api.TypeGroupCall): GroupCallInfoSummary;
|
|
366
|
+
export declare function summarizeGroupCallParticipant(p: Api.TypeGroupCallParticipant): GroupCallParticipantSummary;
|
|
367
|
+
export declare function summarizeGroupCall(result: Api.phone.TypeGroupCall): GroupCallSummary;
|
|
368
|
+
export declare function summarizeGroupCallParticipants(result: Api.phone.TypeGroupParticipants): GroupCallParticipantsSummary;
|
|
369
|
+
export type StarsAmountSummary = {
|
|
370
|
+
amount: string;
|
|
371
|
+
nanos: number;
|
|
372
|
+
};
|
|
373
|
+
export type StarsTransactionPeerSummary = {
|
|
374
|
+
kind: "appStore";
|
|
375
|
+
} | {
|
|
376
|
+
kind: "playMarket";
|
|
377
|
+
} | {
|
|
378
|
+
kind: "premiumBot";
|
|
379
|
+
} | {
|
|
380
|
+
kind: "fragment";
|
|
381
|
+
} | {
|
|
382
|
+
kind: "ads";
|
|
383
|
+
} | {
|
|
384
|
+
kind: "api";
|
|
385
|
+
} | {
|
|
386
|
+
kind: "unsupported";
|
|
387
|
+
} | {
|
|
388
|
+
kind: "peer";
|
|
389
|
+
peer: CompactPeer | undefined;
|
|
390
|
+
};
|
|
391
|
+
export type StarsTransactionSummary = {
|
|
392
|
+
id: string;
|
|
393
|
+
stars: StarsAmountSummary;
|
|
394
|
+
date: number;
|
|
395
|
+
peer: StarsTransactionPeerSummary;
|
|
396
|
+
refund?: boolean;
|
|
397
|
+
pending?: boolean;
|
|
398
|
+
failed?: boolean;
|
|
399
|
+
gift?: boolean;
|
|
400
|
+
reaction?: boolean;
|
|
401
|
+
title?: string;
|
|
402
|
+
description?: string;
|
|
403
|
+
msgId?: number;
|
|
404
|
+
subscriptionPeriod?: number;
|
|
405
|
+
giveawayPostId?: number;
|
|
406
|
+
transactionDate?: number;
|
|
407
|
+
transactionUrl?: string;
|
|
408
|
+
};
|
|
409
|
+
export type StarsSubscriptionPricingSummary = {
|
|
410
|
+
period: number;
|
|
411
|
+
amount: string;
|
|
412
|
+
};
|
|
413
|
+
export type StarsSubscriptionSummary = {
|
|
414
|
+
id: string;
|
|
415
|
+
peer: CompactPeer | undefined;
|
|
416
|
+
untilDate: number;
|
|
417
|
+
pricing: StarsSubscriptionPricingSummary;
|
|
418
|
+
canceled?: boolean;
|
|
419
|
+
canRefulfill?: boolean;
|
|
420
|
+
missingBalance?: boolean;
|
|
421
|
+
botCanceled?: boolean;
|
|
422
|
+
chatInviteHash?: string;
|
|
423
|
+
title?: string;
|
|
424
|
+
invoiceSlug?: string;
|
|
425
|
+
};
|
|
426
|
+
export type StarsStatusSummary = {
|
|
427
|
+
balance: StarsAmountSummary;
|
|
428
|
+
subscriptions?: StarsSubscriptionSummary[];
|
|
429
|
+
subscriptionsNextOffset?: string;
|
|
430
|
+
subscriptionsMissingBalance?: string;
|
|
431
|
+
history?: StarsTransactionSummary[];
|
|
432
|
+
nextOffset?: string;
|
|
433
|
+
};
|
|
434
|
+
export declare function summarizeStarsAmount(amount: Api.TypeStarsAmount): StarsAmountSummary;
|
|
435
|
+
export declare function summarizeStarsTransactionPeer(peer: Api.TypeStarsTransactionPeer): StarsTransactionPeerSummary;
|
|
436
|
+
export declare function summarizeStarsTransaction(tx: Api.TypeStarsTransaction): StarsTransactionSummary;
|
|
437
|
+
export declare function summarizeStarsSubscription(sub: Api.TypeStarsSubscription): StarsSubscriptionSummary;
|
|
438
|
+
export type QuickReplySummary = {
|
|
439
|
+
shortcutId: number;
|
|
440
|
+
shortcut: string;
|
|
441
|
+
topMessage: number;
|
|
442
|
+
count: number;
|
|
443
|
+
};
|
|
444
|
+
export type QuickRepliesSummary = {
|
|
445
|
+
notModified?: boolean;
|
|
446
|
+
quickReplies?: QuickReplySummary[];
|
|
447
|
+
};
|
|
448
|
+
export declare function summarizeQuickReply(reply: Api.TypeQuickReply): QuickReplySummary;
|
|
449
|
+
export declare function summarizeQuickReplies(result: Api.messages.TypeQuickReplies): QuickRepliesSummary;
|
|
450
|
+
export type QuickReplyMessageSummary = {
|
|
451
|
+
id: number;
|
|
452
|
+
date: number;
|
|
453
|
+
text: string;
|
|
454
|
+
isService: boolean;
|
|
455
|
+
fromId?: CompactPeer;
|
|
456
|
+
replyToMsgId?: number;
|
|
457
|
+
};
|
|
458
|
+
export type QuickReplyMessagesSummary = {
|
|
459
|
+
notModified?: boolean;
|
|
460
|
+
count?: number;
|
|
461
|
+
messages?: QuickReplyMessageSummary[];
|
|
462
|
+
};
|
|
463
|
+
export declare function summarizeQuickReplyMessage(msg: Api.TypeMessage): QuickReplyMessageSummary | null;
|
|
464
|
+
export declare function summarizeQuickReplyMessages(result: Api.messages.TypeMessages): QuickReplyMessagesSummary;
|
|
465
|
+
export declare function summarizeStarsStatus(result: Api.payments.TypeStarsStatus): StarsStatusSummary;
|
|
466
|
+
export declare function summarizeStoryItem(item: Api.TypeStoryItem): StoryItemSummary;
|
|
467
|
+
export declare function summarizePeerStories(ps: Api.TypePeerStories): PeerStoriesSummary | null;
|
|
468
|
+
export declare function summarizeStoriesById(result: Api.stories.TypeStories): StoriesByIdSummary;
|
|
469
|
+
export declare function summarizeStoryView(view: Api.TypeStoryView): StoryViewSummary;
|
|
470
|
+
export declare function summarizeStoryViewsList(result: Api.stories.TypeStoryViewsList): StoryViewsListSummary;
|
|
471
|
+
export declare function summarizeAllStories(result: Api.stories.TypeAllStories): AllStoriesSummary;
|
|
3
472
|
export declare class TelegramService {
|
|
4
473
|
private client;
|
|
5
474
|
private apiId;
|
|
@@ -8,6 +477,7 @@ export declare class TelegramService {
|
|
|
8
477
|
private connected;
|
|
9
478
|
private sessionPath;
|
|
10
479
|
private rateLimiter;
|
|
480
|
+
private lastTypingAt;
|
|
11
481
|
lastError: string;
|
|
12
482
|
get sessionDir(): string;
|
|
13
483
|
getClient(): TelegramClient | null;
|
|
@@ -87,8 +557,6 @@ export declare class TelegramService {
|
|
|
87
557
|
blockUser(userId: string): Promise<void>;
|
|
88
558
|
reportSpam(chatId: string): Promise<void>;
|
|
89
559
|
markAsRead(chatId: string): Promise<void>;
|
|
90
|
-
private static TYPING_ACTIONS;
|
|
91
|
-
setTyping(chatId: string, action?: keyof typeof TelegramService.TYPING_ACTIONS): Promise<void>;
|
|
92
560
|
getMessageById(chatId: string, messageId: number): Promise<{
|
|
93
561
|
id: number;
|
|
94
562
|
text: string;
|
|
@@ -108,6 +576,68 @@ export declare class TelegramService {
|
|
|
108
576
|
forwardMessage(fromChatId: string, toChatId: string, messageIds: number[]): Promise<void>;
|
|
109
577
|
editMessage(chatId: string, messageId: number, newText: string): Promise<void>;
|
|
110
578
|
deleteMessages(chatId: string, messageIds: number[]): Promise<void>;
|
|
579
|
+
getScheduledMessages(chatId: string): Promise<Array<{
|
|
580
|
+
id: number;
|
|
581
|
+
date: string;
|
|
582
|
+
text: string;
|
|
583
|
+
media?: {
|
|
584
|
+
type: string;
|
|
585
|
+
fileName?: string;
|
|
586
|
+
size?: number;
|
|
587
|
+
};
|
|
588
|
+
}>>;
|
|
589
|
+
deleteScheduledMessages(chatId: string, messageIds: number[]): Promise<void>;
|
|
590
|
+
getReplies(chatId: string, messageId: number, limit?: number): Promise<Array<{
|
|
591
|
+
id: number;
|
|
592
|
+
text: string;
|
|
593
|
+
sender: string;
|
|
594
|
+
date: string;
|
|
595
|
+
media?: {
|
|
596
|
+
type: string;
|
|
597
|
+
fileName?: string;
|
|
598
|
+
size?: number;
|
|
599
|
+
};
|
|
600
|
+
reactions?: {
|
|
601
|
+
emoji: string;
|
|
602
|
+
count: number;
|
|
603
|
+
me: boolean;
|
|
604
|
+
}[];
|
|
605
|
+
}>>;
|
|
606
|
+
getMessageLink(chatId: string, messageId: number, thread?: boolean): Promise<string>;
|
|
607
|
+
getUnreadMentions(chatId: string, limit?: number): Promise<Array<{
|
|
608
|
+
id: number;
|
|
609
|
+
text: string;
|
|
610
|
+
sender: string;
|
|
611
|
+
date: string;
|
|
612
|
+
media?: {
|
|
613
|
+
type: string;
|
|
614
|
+
fileName?: string;
|
|
615
|
+
size?: number;
|
|
616
|
+
};
|
|
617
|
+
reactions?: {
|
|
618
|
+
emoji: string;
|
|
619
|
+
count: number;
|
|
620
|
+
me: boolean;
|
|
621
|
+
}[];
|
|
622
|
+
}>>;
|
|
623
|
+
getUnreadReactions(chatId: string, limit?: number): Promise<Array<{
|
|
624
|
+
id: number;
|
|
625
|
+
text: string;
|
|
626
|
+
sender: string;
|
|
627
|
+
date: string;
|
|
628
|
+
media?: {
|
|
629
|
+
type: string;
|
|
630
|
+
fileName?: string;
|
|
631
|
+
size?: number;
|
|
632
|
+
};
|
|
633
|
+
reactions?: {
|
|
634
|
+
emoji: string;
|
|
635
|
+
count: number;
|
|
636
|
+
me: boolean;
|
|
637
|
+
}[];
|
|
638
|
+
}>>;
|
|
639
|
+
translateText(chatId: string, messageIds: number[], toLang: string): Promise<string[]>;
|
|
640
|
+
sendTyping(chatId: string, action?: "typing" | "upload_photo" | "upload_document" | "cancel"): Promise<void>;
|
|
111
641
|
/**
|
|
112
642
|
* Resolve a chat by ID, username, or display name.
|
|
113
643
|
* Falls back to searching user's dialogs if getEntity() fails.
|
|
@@ -258,6 +788,13 @@ export declare class TelegramService {
|
|
|
258
788
|
}[];
|
|
259
789
|
total: number;
|
|
260
790
|
}>;
|
|
791
|
+
setDefaultReaction(emoji: string): Promise<void>;
|
|
792
|
+
getTopReactions(limit: number): Promise<Array<{
|
|
793
|
+
emoji: string;
|
|
794
|
+
}>>;
|
|
795
|
+
getRecentReactions(limit: number): Promise<Array<{
|
|
796
|
+
emoji: string;
|
|
797
|
+
}>>;
|
|
261
798
|
sendScheduledMessage(chatId: string, text: string, scheduleDate: number, replyTo?: number, parseMode?: "md" | "html"): Promise<void>;
|
|
262
799
|
createPoll(chatId: string, question: string, answers: string[], options?: {
|
|
263
800
|
multipleChoice?: boolean;
|
|
@@ -327,6 +864,110 @@ export declare class TelegramService {
|
|
|
327
864
|
removeAdmin(chatId: string, userId: string): Promise<void>;
|
|
328
865
|
unblockUser(userId: string): Promise<void>;
|
|
329
866
|
muteChat(chatId: string, muteUntil: number): Promise<void>;
|
|
867
|
+
archiveChat(chatId: string, archive: boolean): Promise<void>;
|
|
868
|
+
pinDialog(chatId: string, pin: boolean): Promise<void>;
|
|
869
|
+
markDialogUnread(chatId: string, unread: boolean): Promise<void>;
|
|
870
|
+
getAdminLog(chatId: string, limit?: number, q?: string): Promise<Array<{
|
|
871
|
+
id: string;
|
|
872
|
+
date: string;
|
|
873
|
+
userId: string;
|
|
874
|
+
userName: string;
|
|
875
|
+
action: string;
|
|
876
|
+
details: string;
|
|
877
|
+
}>>;
|
|
878
|
+
setChatPermissions(chatId: string, permissions: ChatPermissions): Promise<void>;
|
|
879
|
+
setSlowMode(chatId: string, seconds: number): Promise<void>;
|
|
880
|
+
toggleChannelSignatures(chatId: string, enabled: boolean): Promise<void>;
|
|
881
|
+
toggleAntiSpam(chatId: string, enabled: boolean): Promise<void>;
|
|
882
|
+
toggleForumMode(chatId: string, enabled: boolean): Promise<void>;
|
|
883
|
+
togglePrehistoryHidden(chatId: string, hidden: boolean): Promise<void>;
|
|
884
|
+
setChatAvailableReactions(chatId: string, reactions: {
|
|
885
|
+
type: "all";
|
|
886
|
+
allowCustom?: boolean;
|
|
887
|
+
} | {
|
|
888
|
+
type: "some";
|
|
889
|
+
emoji: string[];
|
|
890
|
+
} | {
|
|
891
|
+
type: "none";
|
|
892
|
+
}): Promise<void>;
|
|
893
|
+
approveChatJoinRequest(chatId: string, userId: string, approved: boolean): Promise<void>;
|
|
894
|
+
getInlineBotResults(bot: string, chatId: string, query: string, offset?: string): Promise<{
|
|
895
|
+
queryId: string;
|
|
896
|
+
nextOffset?: string;
|
|
897
|
+
cacheTime: number;
|
|
898
|
+
gallery: boolean;
|
|
899
|
+
results: Array<{
|
|
900
|
+
id: string;
|
|
901
|
+
type: string;
|
|
902
|
+
title?: string;
|
|
903
|
+
description?: string;
|
|
904
|
+
url?: string;
|
|
905
|
+
}>;
|
|
906
|
+
}>;
|
|
907
|
+
sendInlineBotResult(chatId: string, queryId: string, resultId: string, options?: {
|
|
908
|
+
replyTo?: number;
|
|
909
|
+
silent?: boolean;
|
|
910
|
+
hideVia?: boolean;
|
|
911
|
+
clearDraft?: boolean;
|
|
912
|
+
}): Promise<{
|
|
913
|
+
messageId: number;
|
|
914
|
+
}>;
|
|
915
|
+
pressButton(chatId: string, messageId: number, options: {
|
|
916
|
+
buttonIndex?: {
|
|
917
|
+
row: number;
|
|
918
|
+
column: number;
|
|
919
|
+
};
|
|
920
|
+
data?: string;
|
|
921
|
+
}): Promise<{
|
|
922
|
+
alert?: boolean;
|
|
923
|
+
hasUrl?: boolean;
|
|
924
|
+
nativeUi?: boolean;
|
|
925
|
+
message?: string;
|
|
926
|
+
url?: string;
|
|
927
|
+
cacheTime: number;
|
|
928
|
+
}>;
|
|
929
|
+
getMessageButtons(chatId: string, messageId: number): Promise<{
|
|
930
|
+
markupType: string;
|
|
931
|
+
buttons: MessageButtonDescriptor[];
|
|
932
|
+
}>;
|
|
933
|
+
getBroadcastStats(chatId: string, options?: {
|
|
934
|
+
dark?: boolean;
|
|
935
|
+
includeGraphs?: boolean;
|
|
936
|
+
}): Promise<BroadcastStatsSummary>;
|
|
937
|
+
getMegagroupStats(chatId: string, options?: {
|
|
938
|
+
dark?: boolean;
|
|
939
|
+
includeGraphs?: boolean;
|
|
940
|
+
}): Promise<MegagroupStatsSummary>;
|
|
941
|
+
getUpdatesState(): Promise<{
|
|
942
|
+
pts: number;
|
|
943
|
+
qts: number;
|
|
944
|
+
date: number;
|
|
945
|
+
seq: number;
|
|
946
|
+
unreadCount: number;
|
|
947
|
+
}>;
|
|
948
|
+
getUpdates(cursor: {
|
|
949
|
+
pts: number;
|
|
950
|
+
date: number;
|
|
951
|
+
qts: number;
|
|
952
|
+
ptsLimit?: number;
|
|
953
|
+
ptsTotalLimit?: number;
|
|
954
|
+
}): Promise<UpdatesDifferenceSummary>;
|
|
955
|
+
getChannelUpdates(chatId: string, cursor: {
|
|
956
|
+
pts: number;
|
|
957
|
+
limit?: number;
|
|
958
|
+
force?: boolean;
|
|
959
|
+
}): Promise<ChannelDifferenceSummary>;
|
|
960
|
+
createForumTopic(chatId: string, title: string, iconColor?: number, iconEmojiId?: string): Promise<{
|
|
961
|
+
id: number;
|
|
962
|
+
title: string;
|
|
963
|
+
}>;
|
|
964
|
+
editForumTopic(chatId: string, topicId: number, options: {
|
|
965
|
+
title?: string;
|
|
966
|
+
iconEmojiId?: string;
|
|
967
|
+
closed?: boolean;
|
|
968
|
+
hidden?: boolean;
|
|
969
|
+
}): Promise<void>;
|
|
970
|
+
deleteForumTopic(chatId: string, topicId: number): Promise<void>;
|
|
330
971
|
exportInviteLink(chatId: string, options?: {
|
|
331
972
|
expireDate?: number;
|
|
332
973
|
usageLimit?: number;
|
|
@@ -391,9 +1032,77 @@ export declare class TelegramService {
|
|
|
391
1032
|
count: number;
|
|
392
1033
|
}>>;
|
|
393
1034
|
sendSticker(chatId: string, stickerSetShortName: string, stickerIndex: number, replyTo?: number): Promise<Api.Message | Api.UpdateShortSentMessage | undefined>;
|
|
1035
|
+
saveDraft(chatId: string, text: string, replyTo?: number): Promise<void>;
|
|
1036
|
+
getAllDrafts(): Promise<Array<{
|
|
1037
|
+
chatId: string;
|
|
1038
|
+
chatTitle: string;
|
|
1039
|
+
text: string;
|
|
1040
|
+
date: string;
|
|
1041
|
+
}>>;
|
|
1042
|
+
clearAllDrafts(): Promise<void>;
|
|
1043
|
+
getSavedDialogs(limit: number): Promise<Array<{
|
|
1044
|
+
peerId: string;
|
|
1045
|
+
peerTitle: string;
|
|
1046
|
+
lastMsgId: number;
|
|
1047
|
+
}>>;
|
|
1048
|
+
getWebPreview(url: string): Promise<{
|
|
1049
|
+
type: string;
|
|
1050
|
+
url?: string;
|
|
1051
|
+
title?: string;
|
|
1052
|
+
description?: string;
|
|
1053
|
+
siteName?: string;
|
|
1054
|
+
} | null>;
|
|
394
1055
|
getRecentStickers(): Promise<Array<{
|
|
395
1056
|
id: string;
|
|
396
1057
|
accessHash: string;
|
|
397
1058
|
emoji: string;
|
|
398
1059
|
}>>;
|
|
1060
|
+
getAllStories(options?: {
|
|
1061
|
+
next?: boolean;
|
|
1062
|
+
hidden?: boolean;
|
|
1063
|
+
state?: string;
|
|
1064
|
+
}): Promise<AllStoriesSummary>;
|
|
1065
|
+
getPeerStories(chatId: string): Promise<PeerStoriesSummary | null>;
|
|
1066
|
+
getStoriesById(chatId: string, ids: number[]): Promise<StoriesByIdSummary>;
|
|
1067
|
+
getStoryViewsList(chatId: string, options: {
|
|
1068
|
+
id: number;
|
|
1069
|
+
q?: string;
|
|
1070
|
+
justContacts?: boolean;
|
|
1071
|
+
reactionsFirst?: boolean;
|
|
1072
|
+
forwardsFirst?: boolean;
|
|
1073
|
+
offset?: string;
|
|
1074
|
+
limit?: number;
|
|
1075
|
+
}): Promise<StoryViewsListSummary>;
|
|
1076
|
+
getMyBoosts(): Promise<MyBoostsSummary>;
|
|
1077
|
+
getBoostsStatus(chatId: string): Promise<BoostsStatusSummary>;
|
|
1078
|
+
getBoostsList(chatId: string, options?: {
|
|
1079
|
+
gifts?: boolean;
|
|
1080
|
+
offset?: string;
|
|
1081
|
+
limit?: number;
|
|
1082
|
+
}): Promise<BoostsListSummary>;
|
|
1083
|
+
getBusinessChatLinks(): Promise<BusinessChatLinksSummary>;
|
|
1084
|
+
getGroupCall(chatId: string, options?: {
|
|
1085
|
+
limit?: number;
|
|
1086
|
+
}): Promise<GroupCallSummary>;
|
|
1087
|
+
getGroupCallParticipants(chatId: string, options?: {
|
|
1088
|
+
ids?: string[];
|
|
1089
|
+
sources?: number[];
|
|
1090
|
+
offset?: string;
|
|
1091
|
+
limit?: number;
|
|
1092
|
+
}): Promise<GroupCallParticipantsSummary>;
|
|
1093
|
+
getStarsStatus(chatId: string): Promise<StarsStatusSummary>;
|
|
1094
|
+
getStarsTransactions(chatId: string, options?: {
|
|
1095
|
+
inbound?: boolean;
|
|
1096
|
+
outbound?: boolean;
|
|
1097
|
+
ascending?: boolean;
|
|
1098
|
+
subscriptionId?: string;
|
|
1099
|
+
offset?: string;
|
|
1100
|
+
limit?: number;
|
|
1101
|
+
}): Promise<StarsStatusSummary>;
|
|
1102
|
+
getQuickReplies(hash?: string): Promise<QuickRepliesSummary>;
|
|
1103
|
+
getQuickReplyMessages(shortcutId: number, options?: {
|
|
1104
|
+
ids?: number[];
|
|
1105
|
+
hash?: string;
|
|
1106
|
+
}): Promise<QuickReplyMessagesSummary>;
|
|
1107
|
+
private resolveInputGroupCall;
|
|
399
1108
|
}
|