diff --git a/electron-app/src/server/websites/telegram/telegram.service.ts b/electron-app/src/server/websites/telegram/telegram.service.ts index f1e40dbb..b83e2221 100644 --- a/electron-app/src/server/websites/telegram/telegram.service.ts +++ b/electron-app/src/server/websites/telegram/telegram.service.ts @@ -1,4 +1,5 @@ -import { MTProto } from '@mtproto/core'; +const MTProtoClass = require('@mtproto/core'); +import { MTProto } from '@mtproto/core' import { Injectable } from '@nestjs/common'; import { DefaultOptions, @@ -175,10 +176,12 @@ export class Telegram extends Website { if (appId && appHash && phoneNumber) { if (!this.instances[appId]) { - this.instances[appId] = new MTProto({ + this.instances[appId] = new MTProtoClass({ api_id: Number(appId), api_hash: appHash, - customLocalStorage: new TelegramStorage(appId), + storageOptions: { + instance: new TelegramStorage(appId) + }, }); // COMMENTED OUT SINCE IT MIGHT BE BETTER TO CATCH THIS AND SET DURING AUTH TIME diff --git a/electron-app/src/server/websites/telegram/telegram.storage.ts b/electron-app/src/server/websites/telegram/telegram.storage.ts index 3c83005d..98e8eef8 100644 --- a/electron-app/src/server/websites/telegram/telegram.storage.ts +++ b/electron-app/src/server/websites/telegram/telegram.storage.ts @@ -24,11 +24,11 @@ export class TelegramStorage { return join(BASE_DIRECTORY, 'auth', 'telegram', `${this.name}.json`); } - getItem(key: string): Promise { + get(key: string): Promise { return this.storage[key]; } - setItem(key: string, value: any): Promise { + set(key: string, value: any): Promise { this.storage[key] = value; return writeJSON(this.getFileName(), this.storage, { spaces: 1 }).then(() => this.storage[key]); }