common-tg-service 1.0.8 → 1.0.9
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/components/ConfigurationInit/init.module.js +0 -4
- package/dist/components/ConfigurationInit/init.module.js.map +1 -1
- package/dist/components/Telegram/Telegram.controller.d.ts +37 -21
- package/dist/components/Telegram/Telegram.controller.js +125 -68
- package/dist/components/Telegram/Telegram.controller.js.map +1 -1
- package/dist/components/Telegram/Telegram.service.d.ts +54 -19
- package/dist/components/Telegram/Telegram.service.js +85 -8
- package/dist/components/Telegram/Telegram.service.js.map +1 -1
- package/dist/components/Telegram/TelegramManager.d.ts +60 -20
- package/dist/components/Telegram/TelegramManager.js +270 -205
- package/dist/components/Telegram/TelegramManager.js.map +1 -1
- package/dist/components/Telegram/dto/index.d.ts +1 -0
- package/dist/components/Telegram/dto/index.js +1 -0
- package/dist/components/Telegram/dto/index.js.map +1 -1
- package/dist/components/Telegram/dto/view-once-media.dto.d.ts +14 -0
- package/dist/components/Telegram/dto/view-once-media.dto.js +95 -0
- package/dist/components/Telegram/dto/view-once-media.dto.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +4 -1
|
@@ -20,19 +20,15 @@ const init_service_1 = require("./init.service");
|
|
|
20
20
|
const configuration_schema_1 = require("./configuration.schema");
|
|
21
21
|
const init_controller_1 = require("./init.controller");
|
|
22
22
|
const mongoose_2 = require("mongoose");
|
|
23
|
-
const fetchWithTimeout_1 = require("../../utils/fetchWithTimeout");
|
|
24
|
-
const logbots_1 = require("../../utils/logbots");
|
|
25
23
|
let initModule = class initModule {
|
|
26
24
|
constructor(connection) {
|
|
27
25
|
this.connection = connection;
|
|
28
26
|
}
|
|
29
27
|
async onModuleInit() {
|
|
30
28
|
console.log(`Started :: ${process.env.clientId}`);
|
|
31
|
-
(0, fetchWithTimeout_1.fetchWithTimeout)(`${(0, logbots_1.notifbot)()}&text=${encodeURIComponent(`Started :: ${process.env.clientId}`)}`);
|
|
32
29
|
}
|
|
33
30
|
async onModuleDestroy() {
|
|
34
31
|
console.log("Init Module Destroying");
|
|
35
|
-
await (0, fetchWithTimeout_1.fetchWithTimeout)(`${(0, logbots_1.notifbot)()}&text=${encodeURIComponent(`closed :: ${process.env.clientId}`)}`);
|
|
36
32
|
this.closeConnection();
|
|
37
33
|
}
|
|
38
34
|
closeConnection() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.module.js","sourceRoot":"","sources":["../../../src/components/ConfigurationInit/init.module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAuF;AACvF,2CAA8C;AAC9C,+CAAsE;AACtE,iDAAsD;AACtD,iEAA6D;AAC7D,uDAA4D;AAC5D,uCAAsC;
|
|
1
|
+
{"version":3,"file":"init.module.js","sourceRoot":"","sources":["../../../src/components/ConfigurationInit/init.module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAuF;AACvF,2CAA8C;AAC9C,+CAAsE;AACtE,iDAAsD;AACtD,iEAA6D;AAC7D,uDAA4D;AAC5D,uCAAsC;AAoB/B,IAAM,UAAU,GAAhB,MAAM,UAAU;IACrB,YAA2D,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;IAAG,CAAC;IACrF,KAAK,CAAC,YAAY;QAChB,OAAO,CAAC,GAAG,CAAC,cAAc,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAA;IAEnD,CAAC;IAED,KAAK,CAAC,eAAe;QACnB,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAA;QAErC,IAAI,CAAC,eAAe,EAAE,CAAC;IACzB,CAAC;IAEO,eAAe;QACrB,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAA;QAC1C,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IAC7B,CAAC;CACF,CAAA;AAjBY,gCAAU;qBAAV,UAAU;IAjBtB,IAAA,eAAM,GAAE;IACR,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,qBAAY,CAAC,OAAO,EAAE;YACtB,yBAAc,CAAC,YAAY,CAAC;gBAC1B,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC;oBACjB,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ;iBAC1B,CAAC;aACH,CAAC;YACF,yBAAc,CAAC,UAAU,CAAC,CAAC;oBACzB,IAAI,EAAE,qBAAqB,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,EAAE,0CAAmB;iBACtF,CAAC,CAAC;SACJ;QACD,SAAS,EAAE,CAAC,mCAAoB,CAAC;QACjC,WAAW,EAAE,CAAC,yCAAuB,CAAC;QACtC,OAAO,EAAE,CAAC,qBAAY,EAAE,yBAAc,CAAC;KACxC,CAAC;IAEa,WAAA,IAAA,eAAM,EAAC,IAAA,6BAAkB,GAAE,CAAC,CAAA;qCAA8B,qBAAU;GADtE,UAAU,CAiBtB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
/// <reference types="multer" />
|
|
1
2
|
import { Response } from 'express';
|
|
2
3
|
import { TelegramService } from './Telegram.service';
|
|
3
|
-
import { SendMediaDto,
|
|
4
|
+
import { SendMediaDto, GroupSettingsDto, GroupMemberOperationDto, AdminOperationDto, ChatCleanupDto, UpdateProfileDto, PrivacySettingsDto, ProfilePhotoDto, ScheduleMessageDto, BatchProcessDto, ForwardBatchDto, ContactExportImportDto, ContactBlockListDto, AddContactsDto, createGroupDto, ViewOnceMediaDto } from './dto';
|
|
4
5
|
import { MessageType } from './dto/message-search.dto';
|
|
5
6
|
import { CreateChatFolderDto } from './dto/create-chat-folder.dto';
|
|
6
7
|
import { MediaAlbumOptions } from './types/telegram-types';
|
|
@@ -29,26 +30,38 @@ export declare class TelegramController {
|
|
|
29
30
|
processed: number;
|
|
30
31
|
errors: Error[];
|
|
31
32
|
}>;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
33
|
+
searchMessages(mobile: string, chatId: string, query: string, types?: MessageType[], limit?: number, minId?: number, maxId?: number): Promise<{
|
|
34
|
+
video?: {
|
|
35
|
+
messages: number[];
|
|
36
|
+
total: number;
|
|
37
|
+
};
|
|
38
|
+
photo?: {
|
|
39
|
+
messages: number[];
|
|
40
|
+
total: number;
|
|
41
|
+
};
|
|
42
|
+
document?: {
|
|
43
|
+
messages: number[];
|
|
44
|
+
total: number;
|
|
45
|
+
};
|
|
46
|
+
voice?: {
|
|
47
|
+
messages: number[];
|
|
48
|
+
total: number;
|
|
49
|
+
};
|
|
50
|
+
text?: {
|
|
51
|
+
messages: number[];
|
|
52
|
+
total: number;
|
|
53
|
+
};
|
|
54
|
+
all?: {
|
|
55
|
+
messages: number[];
|
|
56
|
+
total: number;
|
|
57
|
+
};
|
|
58
|
+
roundVideo?: {
|
|
59
|
+
messages: number[];
|
|
60
|
+
total: number;
|
|
61
|
+
};
|
|
49
62
|
}>;
|
|
50
63
|
getChannelInfo(mobile: string, includeIds?: boolean): Promise<import("./types/telegram-responses").ChannelInfo>;
|
|
51
|
-
|
|
64
|
+
forwardMedia(mobile: string, channel?: string, fromChatId?: string): Promise<void>;
|
|
52
65
|
leaveChannel(mobile: string, channel: string): Promise<void>;
|
|
53
66
|
setup2FA(mobile: string): Promise<string>;
|
|
54
67
|
updatePrivacy(mobile: string): Promise<string>;
|
|
@@ -121,11 +134,13 @@ export declare class TelegramController {
|
|
|
121
134
|
}>;
|
|
122
135
|
addContactsBulk(mobile: string, contactsDto: AddContactsDto): Promise<void>;
|
|
123
136
|
getContacts(mobile: string): Promise<import("telegram").Api.contacts.TypeContacts>;
|
|
124
|
-
getMediaInfo(mobile: string, chatId: string, types?: MediaType[], offset?: number, limit?: number): Promise<any>;
|
|
125
137
|
sendMedia(mobile: string, sendMediaDto: SendMediaDto): Promise<void>;
|
|
126
138
|
downloadMedia(mobile: string, chatId: string, messageId: number, res: Response): Promise<any>;
|
|
127
139
|
sendMediaAlbum(mobile: string, albumDto: MediaAlbumOptions): Promise<import("telegram").Api.TypeUpdates>;
|
|
128
|
-
getMediaMetadata(mobile: string,
|
|
140
|
+
getMediaMetadata(mobile: string, chatId: string, types?: ('photo' | 'video' | 'document' | 'voice')[], startDate?: string, endDate?: string, limit?: number, minId?: number, maxId?: number, all?: boolean): Promise<{
|
|
141
|
+
messages: any[];
|
|
142
|
+
total: number;
|
|
143
|
+
}>;
|
|
129
144
|
getFilteredMedia(mobile: string, chatId: string, types?: ('photo' | 'video' | 'document' | 'voice')[], startDate?: string, endDate?: string, limit?: number, minId?: number, maxId?: number): Promise<{
|
|
130
145
|
messages: {
|
|
131
146
|
messageId: number;
|
|
@@ -168,6 +183,7 @@ export declare class TelegramController {
|
|
|
168
183
|
duration?: number;
|
|
169
184
|
caption?: string;
|
|
170
185
|
}): Promise<import("telegram").Api.TypeUpdates>;
|
|
186
|
+
sendViewOnceMedia(mobile: string, file: Express.Multer.File, viewOnceDto: ViewOnceMediaDto): Promise<import("telegram").Api.TypeUpdates>;
|
|
171
187
|
getChatHistory(mobile: string, chatId: string, offset?: number, limit?: number): Promise<any>;
|
|
172
188
|
validateSession(mobile: string): Promise<{
|
|
173
189
|
isValid: boolean;
|
|
@@ -1,10 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
2
18
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
19
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
20
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
21
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
22
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
23
|
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
25
|
+
if (mod && mod.__esModule) return mod;
|
|
26
|
+
var result = {};
|
|
27
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
28
|
+
__setModuleDefault(result, mod);
|
|
29
|
+
return result;
|
|
30
|
+
};
|
|
8
31
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
32
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
33
|
};
|
|
@@ -21,6 +44,8 @@ const message_search_dto_1 = require("./dto/message-search.dto");
|
|
|
21
44
|
const metadata_operations_dto_1 = require("./dto/metadata-operations.dto");
|
|
22
45
|
const create_chat_folder_dto_1 = require("./dto/create-chat-folder.dto");
|
|
23
46
|
const common_responses_dto_1 = require("./dto/common-responses.dto");
|
|
47
|
+
const platform_express_1 = require("@nestjs/platform-express");
|
|
48
|
+
const multer = __importStar(require("multer"));
|
|
24
49
|
let TelegramController = class TelegramController {
|
|
25
50
|
constructor(telegramService) {
|
|
26
51
|
this.telegramService = telegramService;
|
|
@@ -111,16 +136,10 @@ let TelegramController = class TelegramController {
|
|
|
111
136
|
}
|
|
112
137
|
}, batchOp.delayMs);
|
|
113
138
|
}
|
|
114
|
-
async
|
|
115
|
-
return this.handleTelegramOperation(async () => {
|
|
116
|
-
await this.telegramService.createClient(mobile);
|
|
117
|
-
return this.telegramService.forwardBulkMessages(mobile, bulkOp.fromChatId, bulkOp.toChatId, bulkOp.messageIds);
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
async searchMessages(mobile, chatId, query, types, offset, limit = 20) {
|
|
139
|
+
async searchMessages(mobile, chatId, query, types, limit, minId, maxId) {
|
|
121
140
|
return this.handleTelegramOperation(async () => {
|
|
122
141
|
await this.telegramService.createClient(mobile);
|
|
123
|
-
return this.telegramService.searchMessages(mobile, { chatId, query, types,
|
|
142
|
+
return this.telegramService.searchMessages(mobile, { chatId, query, types, minId, maxId, limit });
|
|
124
143
|
});
|
|
125
144
|
}
|
|
126
145
|
async getChannelInfo(mobile, includeIds) {
|
|
@@ -129,13 +148,10 @@ let TelegramController = class TelegramController {
|
|
|
129
148
|
return this.telegramService.getChannelInfo(mobile, includeIds);
|
|
130
149
|
});
|
|
131
150
|
}
|
|
132
|
-
async
|
|
151
|
+
async forwardMedia(mobile, channel, fromChatId) {
|
|
133
152
|
return this.handleTelegramOperation(async () => {
|
|
134
153
|
await this.telegramService.createClient(mobile);
|
|
135
|
-
|
|
136
|
-
return this.telegramService.joinChannelAndForward(mobile, fromChatId, channel);
|
|
137
|
-
}
|
|
138
|
-
return this.telegramService.joinChannel(mobile, channel);
|
|
154
|
+
return this.telegramService.forwardMedia(mobile, channel, fromChatId);
|
|
139
155
|
});
|
|
140
156
|
}
|
|
141
157
|
async leaveChannel(mobile, channel) {
|
|
@@ -230,12 +246,6 @@ let TelegramController = class TelegramController {
|
|
|
230
246
|
return client.getContacts();
|
|
231
247
|
});
|
|
232
248
|
}
|
|
233
|
-
async getMediaInfo(mobile, chatId, types, offset, limit) {
|
|
234
|
-
return this.handleTelegramOperation(async () => {
|
|
235
|
-
await this.telegramService.createClient(mobile);
|
|
236
|
-
return this.telegramService.getMediaMetadata(mobile, chatId, offset, limit);
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
249
|
async sendMedia(mobile, sendMediaDto) {
|
|
240
250
|
return this.handleTelegramOperation(async () => {
|
|
241
251
|
const client = await this.telegramService.createClient(mobile);
|
|
@@ -257,10 +267,19 @@ let TelegramController = class TelegramController {
|
|
|
257
267
|
return this.telegramService.sendMediaAlbum(mobile, albumDto);
|
|
258
268
|
});
|
|
259
269
|
}
|
|
260
|
-
async getMediaMetadata(mobile,
|
|
270
|
+
async getMediaMetadata(mobile, chatId, types, startDate, endDate, limit, minId, maxId, all) {
|
|
261
271
|
return this.handleTelegramOperation(async () => {
|
|
262
272
|
await this.telegramService.createClient(mobile);
|
|
263
|
-
return this.telegramService.getMediaMetadata(mobile,
|
|
273
|
+
return this.telegramService.getMediaMetadata(mobile, {
|
|
274
|
+
chatId,
|
|
275
|
+
types,
|
|
276
|
+
startDate: startDate ? new Date(startDate) : undefined,
|
|
277
|
+
endDate: endDate ? new Date(endDate) : undefined,
|
|
278
|
+
limit,
|
|
279
|
+
minId,
|
|
280
|
+
maxId,
|
|
281
|
+
all
|
|
282
|
+
});
|
|
264
283
|
});
|
|
265
284
|
}
|
|
266
285
|
async getFilteredMedia(mobile, chatId, types, startDate, endDate, limit, minId, maxId) {
|
|
@@ -382,6 +401,28 @@ let TelegramController = class TelegramController {
|
|
|
382
401
|
return this.telegramService.sendVoiceMessage(mobile, voice);
|
|
383
402
|
});
|
|
384
403
|
}
|
|
404
|
+
async sendViewOnceMedia(mobile, file, viewOnceDto) {
|
|
405
|
+
return this.handleTelegramOperation(async () => {
|
|
406
|
+
await this.telegramService.createClient(mobile);
|
|
407
|
+
if (viewOnceDto.sourceType === dto_1.MediaSourceType.BINARY && file) {
|
|
408
|
+
return this.telegramService.sendViewOnceMedia(mobile, {
|
|
409
|
+
chatId: viewOnceDto.chatId,
|
|
410
|
+
sourceType: viewOnceDto.sourceType,
|
|
411
|
+
binaryData: file.buffer,
|
|
412
|
+
caption: viewOnceDto.caption,
|
|
413
|
+
filename: viewOnceDto.filename || file.originalname
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
return this.telegramService.sendViewOnceMedia(mobile, {
|
|
417
|
+
chatId: viewOnceDto.chatId,
|
|
418
|
+
sourceType: viewOnceDto.sourceType,
|
|
419
|
+
path: viewOnceDto.path,
|
|
420
|
+
base64Data: viewOnceDto.base64Data,
|
|
421
|
+
caption: viewOnceDto.caption,
|
|
422
|
+
filename: viewOnceDto.filename
|
|
423
|
+
});
|
|
424
|
+
});
|
|
425
|
+
}
|
|
385
426
|
async getChatHistory(mobile, chatId, offset, limit) {
|
|
386
427
|
return this.handleTelegramOperation(async () => {
|
|
387
428
|
await this.telegramService.createClient(mobile);
|
|
@@ -645,34 +686,25 @@ __decorate([
|
|
|
645
686
|
__metadata("design:paramtypes", [String, dto_1.BatchProcessDto]),
|
|
646
687
|
__metadata("design:returntype", Promise)
|
|
647
688
|
], TelegramController.prototype, "processBatchMessages", null);
|
|
648
|
-
__decorate([
|
|
649
|
-
(0, common_1.Post)('messages/bulk-forward/:mobile'),
|
|
650
|
-
(0, swagger_1.ApiOperation)({ summary: 'Forward multiple messages' }),
|
|
651
|
-
(0, swagger_1.ApiParam)({ name: 'mobile', description: 'Mobile number', required: true }),
|
|
652
|
-
(0, swagger_1.ApiBody)({ type: dto_1.ForwardBatchDto }),
|
|
653
|
-
__param(0, (0, common_1.Param)('mobile')),
|
|
654
|
-
__param(1, (0, common_1.Body)()),
|
|
655
|
-
__metadata("design:type", Function),
|
|
656
|
-
__metadata("design:paramtypes", [String, dto_1.ForwardBatchDto]),
|
|
657
|
-
__metadata("design:returntype", Promise)
|
|
658
|
-
], TelegramController.prototype, "forwardBulkMessages", null);
|
|
659
689
|
__decorate([
|
|
660
690
|
(0, common_1.Get)('messages/search/:mobile'),
|
|
661
691
|
(0, swagger_1.ApiOperation)({ summary: 'Search messages in a chat' }),
|
|
662
692
|
(0, swagger_1.ApiParam)({ name: 'mobile', description: 'Mobile number', required: true }),
|
|
663
693
|
(0, swagger_1.ApiQuery)({ name: 'chatId', required: true }),
|
|
664
|
-
(0, swagger_1.ApiQuery)({ name: 'query', required:
|
|
694
|
+
(0, swagger_1.ApiQuery)({ name: 'query', required: false }),
|
|
665
695
|
(0, swagger_1.ApiQuery)({ name: 'types', required: false, enum: message_search_dto_1.MessageType, isArray: true }),
|
|
666
|
-
(0, swagger_1.ApiQuery)({ name: '
|
|
667
|
-
(0, swagger_1.ApiQuery)({ name: '
|
|
696
|
+
(0, swagger_1.ApiQuery)({ name: 'limit', description: 'Number of messages to fetch', required: false, type: Number }),
|
|
697
|
+
(0, swagger_1.ApiQuery)({ name: 'minId', required: false, type: Number }),
|
|
698
|
+
(0, swagger_1.ApiQuery)({ name: 'maxId', required: false, type: Number }),
|
|
668
699
|
__param(0, (0, common_1.Param)('mobile')),
|
|
669
700
|
__param(1, (0, common_1.Query)('chatId')),
|
|
670
701
|
__param(2, (0, common_1.Query)('query')),
|
|
671
702
|
__param(3, (0, common_1.Query)('types')),
|
|
672
|
-
__param(4, (0, common_1.Query)('
|
|
673
|
-
__param(5, (0, common_1.Query)('
|
|
703
|
+
__param(4, (0, common_1.Query)('limit')),
|
|
704
|
+
__param(5, (0, common_1.Query)('minId')),
|
|
705
|
+
__param(6, (0, common_1.Query)('maxId')),
|
|
674
706
|
__metadata("design:type", Function),
|
|
675
|
-
__metadata("design:paramtypes", [String, String, String, Array, Number, Number]),
|
|
707
|
+
__metadata("design:paramtypes", [String, String, String, Array, Number, Number, Number]),
|
|
676
708
|
__metadata("design:returntype", Promise)
|
|
677
709
|
], TelegramController.prototype, "searchMessages", null);
|
|
678
710
|
__decorate([
|
|
@@ -687,20 +719,18 @@ __decorate([
|
|
|
687
719
|
__metadata("design:returntype", Promise)
|
|
688
720
|
], TelegramController.prototype, "getChannelInfo", null);
|
|
689
721
|
__decorate([
|
|
690
|
-
(0, common_1.Post)('
|
|
691
|
-
(0, swagger_1.ApiOperation)({ summary: '
|
|
722
|
+
(0, common_1.Post)('forwardMediatoMe/:mobile'),
|
|
723
|
+
(0, swagger_1.ApiOperation)({ summary: 'Forward media messages to me' }),
|
|
692
724
|
(0, swagger_1.ApiParam)({ name: 'mobile', description: 'Mobile number', required: true }),
|
|
693
|
-
(0, swagger_1.
|
|
694
|
-
(0, swagger_1.ApiQuery)({ name: 'forward', description: 'Whether to forward messages after joining', required: false, type: Boolean }),
|
|
725
|
+
(0, swagger_1.ApiQuery)({ name: 'channel', description: 'Channel username or ID', required: false }),
|
|
695
726
|
(0, swagger_1.ApiQuery)({ name: 'fromChatId', description: 'Source chat ID to forward messages from', required: false }),
|
|
696
727
|
__param(0, (0, common_1.Param)('mobile')),
|
|
697
|
-
__param(1, (0, common_1.
|
|
698
|
-
__param(2, (0, common_1.Query)('
|
|
699
|
-
__param(3, (0, common_1.Query)('fromChatId')),
|
|
728
|
+
__param(1, (0, common_1.Query)('channel')),
|
|
729
|
+
__param(2, (0, common_1.Query)('fromChatId')),
|
|
700
730
|
__metadata("design:type", Function),
|
|
701
|
-
__metadata("design:paramtypes", [String, String,
|
|
731
|
+
__metadata("design:paramtypes", [String, String, String]),
|
|
702
732
|
__metadata("design:returntype", Promise)
|
|
703
|
-
], TelegramController.prototype, "
|
|
733
|
+
], TelegramController.prototype, "forwardMedia", null);
|
|
704
734
|
__decorate([
|
|
705
735
|
(0, common_1.Post)('channels/leave/:mobile'),
|
|
706
736
|
(0, swagger_1.ApiOperation)({ summary: 'Leave channel' }),
|
|
@@ -855,23 +885,6 @@ __decorate([
|
|
|
855
885
|
__metadata("design:paramtypes", [String]),
|
|
856
886
|
__metadata("design:returntype", Promise)
|
|
857
887
|
], TelegramController.prototype, "getContacts", null);
|
|
858
|
-
__decorate([
|
|
859
|
-
(0, common_1.Get)('media/info/:mobile'),
|
|
860
|
-
(0, swagger_1.ApiOperation)({ summary: 'Get media messages info' }),
|
|
861
|
-
(0, swagger_1.ApiParam)({ name: 'mobile', description: 'Mobile number', required: true }),
|
|
862
|
-
(0, swagger_1.ApiQuery)({ name: 'chatId', required: true }),
|
|
863
|
-
(0, swagger_1.ApiQuery)({ name: 'types', required: false, enum: dto_1.MediaType, isArray: true }),
|
|
864
|
-
(0, swagger_1.ApiQuery)({ name: 'offset', required: false, type: Number }),
|
|
865
|
-
(0, swagger_1.ApiQuery)({ name: 'limit', required: false, type: Number }),
|
|
866
|
-
__param(0, (0, common_1.Param)('mobile')),
|
|
867
|
-
__param(1, (0, common_1.Query)('chatId')),
|
|
868
|
-
__param(2, (0, common_1.Query)('types')),
|
|
869
|
-
__param(3, (0, common_1.Query)('offset')),
|
|
870
|
-
__param(4, (0, common_1.Query)('limit')),
|
|
871
|
-
__metadata("design:type", Function),
|
|
872
|
-
__metadata("design:paramtypes", [String, String, Array, Number, Number]),
|
|
873
|
-
__metadata("design:returntype", Promise)
|
|
874
|
-
], TelegramController.prototype, "getMediaInfo", null);
|
|
875
888
|
__decorate([
|
|
876
889
|
(0, common_1.Post)('media/send/:mobile'),
|
|
877
890
|
(0, swagger_1.ApiOperation)({ summary: 'Send media message' }),
|
|
@@ -912,12 +925,24 @@ __decorate([
|
|
|
912
925
|
(0, common_1.Get)('media/metadata/:mobile'),
|
|
913
926
|
(0, swagger_1.ApiOperation)({ summary: 'Get media metadata from a chat' }),
|
|
914
927
|
(0, swagger_1.ApiParam)({ name: 'mobile', description: 'Mobile number', required: true }),
|
|
915
|
-
(0, swagger_1.ApiQuery)({
|
|
916
|
-
(0, swagger_1.
|
|
928
|
+
(0, swagger_1.ApiQuery)({ name: 'chatId', required: true }),
|
|
929
|
+
(0, swagger_1.ApiQuery)({ name: 'types', enum: ['photo', 'video', 'document'], required: false, isArray: true }),
|
|
930
|
+
(0, swagger_1.ApiQuery)({ name: 'startDate', required: false }),
|
|
931
|
+
(0, swagger_1.ApiQuery)({ name: 'endDate', required: false }),
|
|
932
|
+
(0, swagger_1.ApiQuery)({ name: 'limit', description: 'Number of messages to fetch', required: false, type: Number }),
|
|
933
|
+
(0, swagger_1.ApiQuery)({ name: 'minId', required: false, type: Number }),
|
|
934
|
+
(0, swagger_1.ApiQuery)({ name: 'maxId', required: false, type: Number }),
|
|
917
935
|
__param(0, (0, common_1.Param)('mobile')),
|
|
918
|
-
__param(1, (0, common_1.Query)()),
|
|
936
|
+
__param(1, (0, common_1.Query)('chatId')),
|
|
937
|
+
__param(2, (0, common_1.Query)('types')),
|
|
938
|
+
__param(3, (0, common_1.Query)('startDate')),
|
|
939
|
+
__param(4, (0, common_1.Query)('endDate')),
|
|
940
|
+
__param(5, (0, common_1.Query)('limit')),
|
|
941
|
+
__param(6, (0, common_1.Query)('minId')),
|
|
942
|
+
__param(7, (0, common_1.Query)('maxId')),
|
|
943
|
+
__param(8, (0, common_1.Query)('all')),
|
|
919
944
|
__metadata("design:type", Function),
|
|
920
|
-
__metadata("design:paramtypes", [String,
|
|
945
|
+
__metadata("design:paramtypes", [String, String, Array, String, String, Number, Number, Number, Boolean]),
|
|
921
946
|
__metadata("design:returntype", Promise)
|
|
922
947
|
], TelegramController.prototype, "getMediaMetadata", null);
|
|
923
948
|
__decorate([
|
|
@@ -1128,6 +1153,38 @@ __decorate([
|
|
|
1128
1153
|
__metadata("design:paramtypes", [String, Object]),
|
|
1129
1154
|
__metadata("design:returntype", Promise)
|
|
1130
1155
|
], TelegramController.prototype, "sendVoiceMessage", null);
|
|
1156
|
+
__decorate([
|
|
1157
|
+
(0, common_1.Post)('media/view-once/:mobile'),
|
|
1158
|
+
(0, swagger_1.ApiOperation)({ summary: 'Send a view once (disappearing) media message' }),
|
|
1159
|
+
(0, swagger_1.ApiParam)({ name: 'mobile', description: 'Mobile number', required: true }),
|
|
1160
|
+
(0, swagger_1.ApiConsumes)('multipart/form-data', 'application/json'),
|
|
1161
|
+
(0, swagger_1.ApiBody)({
|
|
1162
|
+
schema: {
|
|
1163
|
+
type: 'object',
|
|
1164
|
+
properties: {
|
|
1165
|
+
chatId: { type: 'string', description: 'Chat ID to send the media to' },
|
|
1166
|
+
sourceType: { type: 'string', enum: ['path', 'base64', 'binary'], description: 'Source type of media' },
|
|
1167
|
+
path: { type: 'string', description: 'path of the media file (when sourceType is Path)' },
|
|
1168
|
+
base64Data: { type: 'string', description: 'Base64 data (when sourceType is base64)' },
|
|
1169
|
+
binaryData: { type: 'string', format: 'binary', description: 'Binary file (when sourceType is binary)' },
|
|
1170
|
+
caption: { type: 'string', description: 'Optional caption for the media' },
|
|
1171
|
+
filename: { type: 'string', description: 'Optional filename for the media' }
|
|
1172
|
+
},
|
|
1173
|
+
required: ['chatId', 'sourceType']
|
|
1174
|
+
}
|
|
1175
|
+
}),
|
|
1176
|
+
(0, common_1.UseInterceptors)((0, platform_express_1.FileInterceptor)('binaryData', {
|
|
1177
|
+
storage: multer.memoryStorage()
|
|
1178
|
+
})),
|
|
1179
|
+
(0, swagger_1.ApiResponse)({ status: 200, description: 'View once media sent successfully' }),
|
|
1180
|
+
(0, swagger_1.ApiResponse)({ status: 400, description: 'Failed to send view once media' }),
|
|
1181
|
+
__param(0, (0, common_1.Param)('mobile')),
|
|
1182
|
+
__param(1, (0, common_1.UploadedFile)()),
|
|
1183
|
+
__param(2, (0, common_1.Body)()),
|
|
1184
|
+
__metadata("design:type", Function),
|
|
1185
|
+
__metadata("design:paramtypes", [String, Object, dto_1.ViewOnceMediaDto]),
|
|
1186
|
+
__metadata("design:returntype", Promise)
|
|
1187
|
+
], TelegramController.prototype, "sendViewOnceMedia", null);
|
|
1131
1188
|
__decorate([
|
|
1132
1189
|
(0, common_1.Get)('chat/history/:mobile'),
|
|
1133
1190
|
(0, swagger_1.ApiOperation)({ summary: 'Get chat history with metadata' }),
|