From 5060ba5189651117c06c6ec9384ad8710a54dfe2 Mon Sep 17 00:00:00 2001 From: Nofated <49985975+Nofated095@users.noreply.github.com> Date: Thu, 19 Jan 2023 00:03:32 +0800 Subject: [PATCH] Update Instance.ts --- src/models/Instance.ts | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/models/Instance.ts b/src/models/Instance.ts index 6755025..84751a3 100644 --- a/src/models/Instance.ts +++ b/src/models/Instance.ts @@ -36,7 +36,6 @@ export default class Instance { private readonly log: Logger; private tgBot: Telegram; - private tgUser: Telegram; private oicq: OicqClient; private _ownerChat: TelegramChat; @@ -107,13 +106,13 @@ export default class Instance { this.log.info('当前服务器未配置,请向 Bot 发送 /setup 来设置'); this.setupController = new SetupController(this, this.tgBot); // 这会一直卡在这里,所以要新开一个异步来做,提前返回掉上面的 - ({ tgUser: this.tgUser, oicq: this.oicq } = await this.setupController.waitForFinish()); + ({ oicq: this.oicq } = await this.setupController.waitForFinish()); this._ownerChat = await this.tgBot.getChat(this.owner); } else { this.log.debug('正在登录 TG UserBot'); - this.tgUser = await Telegram.connect(this._userSessionId); - this.log.info('TG UserBot 登录完成'); +// this.tgUser = await Telegram.connect(this._userSessionId); + this.log.info('TG UserBot 登录完成 //skip'); this._ownerChat = await this.tgBot.getChat(this.owner); this.log.debug('正在登录 OICQ'); this.oicq = await OicqClient.create({ @@ -140,7 +139,7 @@ export default class Instance { }); this.log.info('OICQ 登录完成'); } - this.statusReportController = new StatusReportController(this, this.tgBot, this.tgUser, this.oicq); + this.statusReportController = new StatusReportController(this, this.tgBot, this.oicq); this.forwardPairs = await ForwardPairs.load(this.id, this.oicq, this.tgBot); this.setupCommands() .then(() => this.log.info('命令设置成功')) @@ -150,13 +149,13 @@ export default class Instance { } this.oicqErrorNotifyController = new OicqErrorNotifyController(this, this.oicq); this.requestController = new RequestController(this, this.tgBot, this.oicq); - this.configController = new ConfigController(this, this.tgBot, this.tgUser, this.oicq); - this.deleteMessageController = new DeleteMessageController(this, this.tgBot, this.tgUser, this.oicq); - this.inChatCommandsController = new InChatCommandsController(this, this.tgBot, this.tgUser, this.oicq); + this.configController = new ConfigController(this, this.tgBot, this.oicq); + this.deleteMessageController = new DeleteMessageController(this, this.tgBot, this.oicq); + this.inChatCommandsController = new InChatCommandsController(this, this.tgBot, this.oicq); if (this.workMode === 'group') { this.hugController = new HugController(this, this.tgBot, this.oicq); } - this.forwardController = new ForwardController(this, this.tgBot, this.tgUser, this.oicq); + this.forwardController = new ForwardController(this, this.tgBot, this.oicq); if (this.workMode === 'group') { // 希望那个 /q 也被转发 this.quotLyController = new QuotLyController(this, this.tgBot, this.oicq); @@ -243,10 +242,6 @@ export default class Instance { return this.tgBot.me; } - get userMe() { - return this.tgUser.me; - } - get ownerChat() { return this._ownerChat; }