@tgsnake/core
Version:
Pure Telegram MTProto library for nodejs
89 lines (88 loc) • 3.11 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SecretChatMessageService = exports.SecretChatMessage = exports.UpdateSecretChatMessage = void 0;
const Raw_js_1 = require("../Raw.js");
const TLObject_js_1 = require("./TLObject.js");
class UpdateSecretChatMessage extends TLObject_js_1.TLObject {
message;
qts;
_original;
constructor(params) {
super();
this.classType = 'modified_types_UpdateNewEncryptedMessage';
this.className = 'UpdateSecretChatMessage';
this.constructorId = 1;
this.subclassOfId = 0x9f89304e;
this._slots = ['message', 'qts'];
this.message = params.message;
this.qts = params.qts;
this._original = params.original;
}
static async generate(update, secretChat) {
const decrypted = await secretChat.decrypt(update.message);
if (update.message instanceof Raw_js_1.Raw.EncryptedMessageService) {
return new UpdateSecretChatMessage({
message: new SecretChatMessageService({
randomId: update.message.randomId,
chatId: update.message.chatId,
date: update.message.date,
message: decrypted,
}),
qts: update.qts,
original: update,
});
}
return new UpdateSecretChatMessage({
message: new SecretChatMessage({
randomId: update.message.randomId,
chatId: update.message.chatId,
date: update.message.date,
file: update.message.file,
message: decrypted,
}),
qts: update.qts,
original: update,
});
}
}
exports.UpdateSecretChatMessage = UpdateSecretChatMessage;
class SecretChatMessage extends TLObject_js_1.TLObject {
randomId;
chatId;
date;
message;
file;
constructor(params) {
super();
this.classType = 'modified_types_EncryptedMessage';
this.className = 'SecretChatMessage';
this.constructorId = 2;
this.subclassOfId = 0x239f2e51;
this._slots = ['randomId', 'chatId', 'date', 'message', 'file'];
this.randomId = params.randomId;
this.chatId = params.chatId;
this.date = params.date;
this.message = params.message;
this.file = params.file;
}
}
exports.SecretChatMessage = SecretChatMessage;
class SecretChatMessageService extends TLObject_js_1.TLObject {
randomId;
chatId;
date;
message;
constructor(params) {
super();
this.classType = 'modified_types_EncryptedMessageService';
this.className = 'SecretChatMessageService';
this.constructorId = 3;
this.subclassOfId = 0x239f2e51;
this._slots = ['randomId', 'chatId', 'date', 'message'];
this.randomId = params.randomId;
this.chatId = params.chatId;
this.date = params.date;
this.message = params.message;
}
}
exports.SecretChatMessageService = SecretChatMessageService;