@overpod/mcp-telegram 1.20.0 → 1.22.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 +11 -0
- package/dist/telegram-client.d.ts +20 -0
- package/dist/telegram-client.js +42 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.22.0] - 2026-04-01
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- `TelegramService.setTyping(chatId, action?)` — send typing indicators with 10 action types: `typing`, `cancel`, `record_video`, `upload_video`, `record_audio`, `upload_audio`, `upload_photo`, `upload_document`, `choose_sticker`, `game_play` (#17)
|
|
14
|
+
- `TelegramService.getMessageById(chatId, messageId)` — fetch a single message by ID, returns formatted message object or `null`. Uses GramJS `ids` filter for exact lookup (#17)
|
|
15
|
+
|
|
16
|
+
## [1.21.0] - 2026-04-01
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
- `TelegramService.getClient()` — public accessor for the underlying GramJS `TelegramClient` instance, enabling event handlers like `NewMessage` for real-time listeners (#17)
|
|
20
|
+
|
|
10
21
|
## [1.20.0] - 2026-03-31
|
|
11
22
|
|
|
12
23
|
### Added
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TelegramClient } from "telegram";
|
|
1
2
|
import { Api } from "telegram/tl/index.js";
|
|
2
3
|
export declare class TelegramService {
|
|
3
4
|
private client;
|
|
@@ -9,6 +10,7 @@ export declare class TelegramService {
|
|
|
9
10
|
private rateLimiter;
|
|
10
11
|
lastError: string;
|
|
11
12
|
get sessionDir(): string;
|
|
13
|
+
getClient(): TelegramClient | null;
|
|
12
14
|
constructor(apiId: number, apiHash: string, options?: {
|
|
13
15
|
sessionPath?: string;
|
|
14
16
|
});
|
|
@@ -85,6 +87,24 @@ export declare class TelegramService {
|
|
|
85
87
|
blockUser(userId: string): Promise<void>;
|
|
86
88
|
reportSpam(chatId: string): Promise<void>;
|
|
87
89
|
markAsRead(chatId: string): Promise<void>;
|
|
90
|
+
private static TYPING_ACTIONS;
|
|
91
|
+
setTyping(chatId: string, action?: keyof typeof TelegramService.TYPING_ACTIONS): Promise<void>;
|
|
92
|
+
getMessageById(chatId: string, messageId: number): Promise<{
|
|
93
|
+
id: number;
|
|
94
|
+
text: string;
|
|
95
|
+
sender: string;
|
|
96
|
+
date: string;
|
|
97
|
+
media?: {
|
|
98
|
+
type: string;
|
|
99
|
+
fileName?: string;
|
|
100
|
+
size?: number;
|
|
101
|
+
};
|
|
102
|
+
reactions?: {
|
|
103
|
+
emoji: string;
|
|
104
|
+
count: number;
|
|
105
|
+
me: boolean;
|
|
106
|
+
}[];
|
|
107
|
+
} | null>;
|
|
88
108
|
forwardMessage(fromChatId: string, toChatId: string, messageIds: number[]): Promise<void>;
|
|
89
109
|
editMessage(chatId: string, messageId: number, newText: string): Promise<void>;
|
|
90
110
|
deleteMessages(chatId: string, messageIds: number[]): Promise<void>;
|
package/dist/telegram-client.js
CHANGED
|
@@ -56,6 +56,9 @@ export class TelegramService {
|
|
|
56
56
|
get sessionDir() {
|
|
57
57
|
return dirname(this.sessionPath);
|
|
58
58
|
}
|
|
59
|
+
getClient() {
|
|
60
|
+
return this.client;
|
|
61
|
+
}
|
|
59
62
|
constructor(apiId, apiHash, options) {
|
|
60
63
|
this.apiId = apiId;
|
|
61
64
|
this.apiHash = apiHash;
|
|
@@ -523,6 +526,45 @@ export class TelegramService {
|
|
|
523
526
|
throw new Error(NOT_CONNECTED_ERROR);
|
|
524
527
|
await this.client.markAsRead(chatId);
|
|
525
528
|
}
|
|
529
|
+
static TYPING_ACTIONS = {
|
|
530
|
+
typing: () => new Api.SendMessageTypingAction(),
|
|
531
|
+
cancel: () => new Api.SendMessageCancelAction(),
|
|
532
|
+
record_video: () => new Api.SendMessageRecordVideoAction(),
|
|
533
|
+
upload_video: () => new Api.SendMessageUploadVideoAction({ progress: 0 }),
|
|
534
|
+
record_audio: () => new Api.SendMessageRecordAudioAction(),
|
|
535
|
+
upload_audio: () => new Api.SendMessageUploadAudioAction({ progress: 0 }),
|
|
536
|
+
upload_photo: () => new Api.SendMessageUploadPhotoAction({ progress: 0 }),
|
|
537
|
+
upload_document: () => new Api.SendMessageUploadDocumentAction({ progress: 0 }),
|
|
538
|
+
choose_sticker: () => new Api.SendMessageChooseStickerAction(),
|
|
539
|
+
game_play: () => new Api.SendMessageGamePlayAction(),
|
|
540
|
+
};
|
|
541
|
+
async setTyping(chatId, action = "typing") {
|
|
542
|
+
if (!this.client || !this.connected)
|
|
543
|
+
throw new Error(NOT_CONNECTED_ERROR);
|
|
544
|
+
const factory = TelegramService.TYPING_ACTIONS[action];
|
|
545
|
+
if (!factory)
|
|
546
|
+
throw new Error(`Unknown typing action: ${action}. Valid: ${Object.keys(TelegramService.TYPING_ACTIONS).join(", ")}`);
|
|
547
|
+
const resolved = await this.resolvePeer(chatId);
|
|
548
|
+
const peer = await this.client.getInputEntity(resolved);
|
|
549
|
+
await this.client.invoke(new Api.messages.SetTyping({ peer, action: factory() }));
|
|
550
|
+
}
|
|
551
|
+
async getMessageById(chatId, messageId) {
|
|
552
|
+
if (!this.client || !this.connected)
|
|
553
|
+
throw new Error(NOT_CONNECTED_ERROR);
|
|
554
|
+
const resolved = await this.resolvePeer(chatId);
|
|
555
|
+
const messages = await this.client.getMessages(resolved, { ids: [messageId] });
|
|
556
|
+
const m = messages[0];
|
|
557
|
+
if (!m || m.id !== messageId)
|
|
558
|
+
return null;
|
|
559
|
+
return {
|
|
560
|
+
id: m.id,
|
|
561
|
+
text: m.message ?? "",
|
|
562
|
+
sender: await this.resolveSenderName(m.senderId),
|
|
563
|
+
date: new Date((m.date ?? 0) * 1000).toISOString(),
|
|
564
|
+
media: this.extractMediaInfo(m.media),
|
|
565
|
+
reactions: this.extractReactions(m.reactions),
|
|
566
|
+
};
|
|
567
|
+
}
|
|
526
568
|
async forwardMessage(fromChatId, toChatId, messageIds) {
|
|
527
569
|
if (!this.client || !this.connected)
|
|
528
570
|
throw new Error(NOT_CONNECTED_ERROR);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@overpod/mcp-telegram",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.22.0",
|
|
4
4
|
"description": "MCP server for Telegram userbot — messages, media, reactions, polls & more. Built on GramJS/MTProto.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -52,14 +52,14 @@
|
|
|
52
52
|
"url": "https://github.com/overpod/mcp-telegram/issues"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
55
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
56
56
|
"dotenv": "^17.3.1",
|
|
57
57
|
"qrcode": "^1.5.4",
|
|
58
58
|
"telegram": "^2.26.22",
|
|
59
59
|
"zod": "^4.3.6"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@biomejs/biome": "^2.4.
|
|
62
|
+
"@biomejs/biome": "^2.4.10",
|
|
63
63
|
"@types/node": "^25.5.0",
|
|
64
64
|
"@types/qrcode": "^1.5.6",
|
|
65
65
|
"tsx": "^4.21.0",
|