@overpod/mcp-telegram 1.26.0 → 1.26.1
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/dist/index.js +4 -1
- package/dist/rate-limiter.d.ts +1 -1
- package/dist/rate-limiter.js +8 -8
- package/dist/telegram-client.d.ts +6 -470
- package/dist/telegram-client.js +17 -874
- package/dist/telegram-helpers.d.ts +470 -0
- package/dist/telegram-helpers.js +870 -0
- package/dist/tools/account.js +7 -7
- package/dist/tools/boosts.js +4 -4
- package/dist/tools/chats.js +7 -7
- package/dist/tools/contacts.js +3 -3
- package/dist/tools/extras.js +3 -3
- package/dist/tools/group-calls.js +3 -3
- package/dist/tools/messages.js +17 -17
- package/dist/tools/quick-replies.js +3 -3
- package/dist/tools/reactions.js +2 -2
- package/dist/tools/shared.d.ts +3 -3
- package/dist/tools/shared.js +8 -7
- package/dist/tools/stars.js +3 -3
- package/dist/tools/stickers.js +5 -5
- package/dist/tools/stories.js +5 -5
- package/package.json +1 -1
- package/dist/__tests__/admin-log.test.d.ts +0 -1
- package/dist/__tests__/admin-log.test.js +0 -41
- package/dist/__tests__/approve-join-request.test.d.ts +0 -1
- package/dist/__tests__/approve-join-request.test.js +0 -107
- package/dist/__tests__/boosts.test.d.ts +0 -1
- package/dist/__tests__/boosts.test.js +0 -310
- package/dist/__tests__/broadcast-stats.test.d.ts +0 -1
- package/dist/__tests__/broadcast-stats.test.js +0 -172
- package/dist/__tests__/business-chat-links.test.d.ts +0 -1
- package/dist/__tests__/business-chat-links.test.js +0 -102
- package/dist/__tests__/get-message-buttons.test.d.ts +0 -1
- package/dist/__tests__/get-message-buttons.test.js +0 -122
- package/dist/__tests__/group-calls.test.d.ts +0 -1
- package/dist/__tests__/group-calls.test.js +0 -503
- package/dist/__tests__/inline-query-send.test.d.ts +0 -1
- package/dist/__tests__/inline-query-send.test.js +0 -94
- package/dist/__tests__/inline-query.test.d.ts +0 -1
- package/dist/__tests__/inline-query.test.js +0 -115
- package/dist/__tests__/megagroup-stats.test.d.ts +0 -1
- package/dist/__tests__/megagroup-stats.test.js +0 -166
- package/dist/__tests__/press-button.test.d.ts +0 -1
- package/dist/__tests__/press-button.test.js +0 -123
- package/dist/__tests__/quick-replies.test.d.ts +0 -1
- package/dist/__tests__/quick-replies.test.js +0 -245
- package/dist/__tests__/rate-limiter.test.d.ts +0 -1
- package/dist/__tests__/rate-limiter.test.js +0 -81
- package/dist/__tests__/reactions.test.d.ts +0 -1
- package/dist/__tests__/reactions.test.js +0 -23
- package/dist/__tests__/set-chat-permissions-merge.test.d.ts +0 -1
- package/dist/__tests__/set-chat-permissions-merge.test.js +0 -107
- package/dist/__tests__/set-chat-reactions.test.d.ts +0 -1
- package/dist/__tests__/set-chat-reactions.test.js +0 -129
- package/dist/__tests__/stars-status.test.d.ts +0 -1
- package/dist/__tests__/stars-status.test.js +0 -205
- package/dist/__tests__/stars-transactions.test.d.ts +0 -1
- package/dist/__tests__/stars-transactions.test.js +0 -82
- package/dist/__tests__/stories.test.d.ts +0 -1
- package/dist/__tests__/stories.test.js +0 -361
- package/dist/__tests__/toggle-anti-spam.test.d.ts +0 -1
- package/dist/__tests__/toggle-anti-spam.test.js +0 -80
- package/dist/__tests__/toggle-channel-signatures.test.d.ts +0 -1
- package/dist/__tests__/toggle-channel-signatures.test.js +0 -80
- package/dist/__tests__/toggle-forum-mode.test.d.ts +0 -1
- package/dist/__tests__/toggle-forum-mode.test.js +0 -80
- package/dist/__tests__/toggle-prehistory-hidden.test.d.ts +0 -1
- package/dist/__tests__/toggle-prehistory-hidden.test.js +0 -80
- package/dist/__tests__/tools/shared.test.d.ts +0 -1
- package/dist/__tests__/tools/shared.test.js +0 -110
- package/dist/__tests__/updates.test.d.ts +0 -1
- package/dist/__tests__/updates.test.js +0 -221
package/dist/index.js
CHANGED
|
@@ -6,10 +6,13 @@ console.log = (...args) => {
|
|
|
6
6
|
console.error(...args);
|
|
7
7
|
};
|
|
8
8
|
import "dotenv/config";
|
|
9
|
+
import { createRequire } from "node:module";
|
|
9
10
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
10
11
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
11
12
|
import { TelegramService } from "./telegram-client.js";
|
|
12
13
|
import { registerTools } from "./tools/index.js";
|
|
14
|
+
const require = createRequire(import.meta.url);
|
|
15
|
+
const { version } = require("../package.json");
|
|
13
16
|
// Telegram API credentials from env
|
|
14
17
|
const API_ID = Number(process.env.TELEGRAM_API_ID);
|
|
15
18
|
const API_HASH = process.env.TELEGRAM_API_HASH;
|
|
@@ -22,7 +25,7 @@ if (!API_ID || !API_HASH) {
|
|
|
22
25
|
const telegram = new TelegramService(API_ID, API_HASH);
|
|
23
26
|
const server = new McpServer({
|
|
24
27
|
name: "mcp-telegram",
|
|
25
|
-
version
|
|
28
|
+
version,
|
|
26
29
|
});
|
|
27
30
|
registerTools(server, telegram);
|
|
28
31
|
async function main() {
|
package/dist/rate-limiter.d.ts
CHANGED
|
@@ -13,11 +13,11 @@ export interface RateLimiterOptions {
|
|
|
13
13
|
maxRetryDelay?: number;
|
|
14
14
|
}
|
|
15
15
|
export declare class RateLimiter {
|
|
16
|
-
private lastRequestTime;
|
|
17
16
|
private minInterval;
|
|
18
17
|
private maxRetries;
|
|
19
18
|
private initialRetryDelay;
|
|
20
19
|
private maxRetryDelay;
|
|
20
|
+
private slotQueue;
|
|
21
21
|
constructor(options?: RateLimiterOptions);
|
|
22
22
|
/**
|
|
23
23
|
* Execute a function with rate limiting and automatic retry.
|
package/dist/rate-limiter.js
CHANGED
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
* Handles FLOOD_WAIT errors and implements exponential backoff.
|
|
4
4
|
*/
|
|
5
5
|
export class RateLimiter {
|
|
6
|
-
lastRequestTime = 0;
|
|
7
6
|
minInterval;
|
|
8
7
|
maxRetries;
|
|
9
8
|
initialRetryDelay;
|
|
10
9
|
maxRetryDelay;
|
|
10
|
+
// Serializes concurrent calls so each waits for the previous slot to clear
|
|
11
|
+
slotQueue = Promise.resolve();
|
|
11
12
|
constructor(options = {}) {
|
|
12
13
|
const maxRequestsPerSecond = options.maxRequestsPerSecond ?? 20;
|
|
13
14
|
this.minInterval = 1000 / maxRequestsPerSecond;
|
|
@@ -67,13 +68,12 @@ export class RateLimiter {
|
|
|
67
68
|
throw error;
|
|
68
69
|
}
|
|
69
70
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
this.lastRequestTime = Date.now();
|
|
71
|
+
waitForSlot() {
|
|
72
|
+
// Chain onto the previous slot so concurrent callers queue up sequentially.
|
|
73
|
+
// Each turn: wait minInterval from when the previous turn started, then resolve.
|
|
74
|
+
const nextSlot = this.slotQueue.then(() => sleep(this.minInterval));
|
|
75
|
+
this.slotQueue = nextSlot;
|
|
76
|
+
return nextSlot;
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
function isNetworkError(msg) {
|
|
@@ -1,474 +1,9 @@
|
|
|
1
|
-
import bigInt from "big-integer";
|
|
2
1
|
import { TelegramClient } from "telegram";
|
|
3
2
|
import { Api } from "telegram/tl/index.js";
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export type
|
|
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
|
+
import type { AllStoriesSummary, BoostsListSummary, BoostsStatusSummary, BroadcastStatsSummary, BusinessChatLinksSummary, ChannelDifferenceSummary, ChatPermissions, GroupCallParticipantsSummary, GroupCallSummary, MegagroupStatsSummary, MessageButtonDescriptor, MyBoostsSummary, PeerStoriesSummary, QuickRepliesSummary, QuickReplyMessagesSummary, StarsStatusSummary, StoriesByIdSummary, StoryViewsListSummary, UpdatesDifferenceSummary } from "./telegram-helpers.js";
|
|
4
|
+
export type { AllStoriesSummary, BoostSummary, BoostsListSummary, BoostsStatusSummary, BroadcastStatsSummary, BusinessChatLinkSummary, BusinessChatLinksSummary, ChannelDifferenceSummary, ChatPermissions, CompactPeer, CompactStatsGraph, GroupCallInfoSummary, GroupCallParticipantSummary, GroupCallParticipantsSummary, GroupCallSummary, MegagroupStatsSummary, MessageButtonDescriptor, MyBoostSummary, MyBoostsSummary, PeerStoriesSummary, PrepaidGiveawaySummary, QuickRepliesSummary, QuickReplyMessageSummary, QuickReplyMessagesSummary, QuickReplySummary, StarsAmountSummary, StarsStatusSummary, StarsSubscriptionPricingSummary, StarsSubscriptionSummary, StarsTransactionPeerSummary, StarsTransactionSummary, StatsValue, StoriesByIdSummary, StoryItemSummary, StoryViewSummary, StoryViewsListSummary, UpdatesDifferenceSummary, UpdatesMessageSummary, } from "./telegram-helpers.js";
|
|
5
|
+
export { describeAdminLogAction, describeAdminLogDetails, describeKeyboardButton, mergeBannedRights, peerToCompact, reactionToEmoji, summarizeAllStories, summarizeBoost, summarizeBoostsList, summarizeBoostsStatus, summarizeBroadcastStats, summarizeBusinessChatLink, summarizeBusinessChatLinks, summarizeChannelDifference, summarizeGroupCall, summarizeGroupCallInfo, summarizeGroupCallParticipant, summarizeGroupCallParticipants, summarizeMegagroupStats, summarizeMyBoost, summarizeMyBoosts, summarizePeerStories, summarizePrepaidGiveaway, summarizeQuickReplies, summarizeQuickReply, summarizeQuickReplyMessage, summarizeQuickReplyMessages, summarizeStarsAmount, summarizeStarsStatus, summarizeStarsSubscription, summarizeStarsTransaction, summarizeStarsTransactionPeer, summarizeStoriesById, summarizeStoryItem, summarizeStoryView, summarizeStoryViewsList, summarizeUpdatesDifference, } from "./telegram-helpers.js";
|
|
6
|
+
export type ChatEntity = Api.User | Api.Chat | Api.Channel | Api.TypeUser | Api.TypeChat;
|
|
472
7
|
export declare class TelegramService {
|
|
473
8
|
private client;
|
|
474
9
|
private apiId;
|
|
@@ -478,6 +13,7 @@ export declare class TelegramService {
|
|
|
478
13
|
private sessionPath;
|
|
479
14
|
private rateLimiter;
|
|
480
15
|
private lastTypingAt;
|
|
16
|
+
private entityCache;
|
|
481
17
|
lastError: string;
|
|
482
18
|
get sessionDir(): string;
|
|
483
19
|
getClient(): TelegramClient | null;
|
|
@@ -642,7 +178,7 @@ export declare class TelegramService {
|
|
|
642
178
|
* Resolve a chat by ID, username, or display name.
|
|
643
179
|
* Falls back to searching user's dialogs if getEntity() fails.
|
|
644
180
|
*/
|
|
645
|
-
resolveChat(chatId: string): Promise<
|
|
181
|
+
resolveChat(chatId: string): Promise<ChatEntity>;
|
|
646
182
|
/**
|
|
647
183
|
* Resolve chatId to a peer string that GramJS methods accept.
|
|
648
184
|
* Handles display names by searching dialogs.
|