diff --git a/src/controllers/ConfigController.ts b/src/controllers/ConfigController.ts index ca4c38c..654b58a 100644 --- a/src/controllers/ConfigController.ts +++ b/src/controllers/ConfigController.ts @@ -91,7 +91,7 @@ export default class ConfigController { }; private handleQqMessage = async (message: GroupMessageEvent | PrivateMessageEvent) => { - if (message.message_type !== 'private') return false; + if (message.message_type !== 'private' || this.instance.workMode === 'group') return false; const pair = this.instance.forwardPairs.find(message.friend); if (pair) return false; // 如果正在创建中,应该阻塞 diff --git a/src/services/ConfigService.ts b/src/services/ConfigService.ts index 4791cff..23c26c3 100644 --- a/src/services/ConfigService.ts +++ b/src/services/ConfigService.ts @@ -22,7 +22,7 @@ export default class ConfigService { private readonly tgBot: Telegram, private readonly tgUser: Telegram, private readonly oicq: OicqClient) { - this.log = getLogger(`ConfigService - ${instance.id}`) + this.log = getLogger(`ConfigService - ${instance.id}`); this.owner = tgBot.getChat(this.instance.owner); } @@ -231,6 +231,7 @@ export default class ConfigService { } catch (e) { message = `错误:${e}`; + this.log.error(e); } await (await this.owner).sendMessage({ message }); } @@ -295,11 +296,11 @@ export default class ConfigService { return text + `\n\n由 @${this.tgBot.me.username} 管理`; } - public async migrateAllChats(){ + public async migrateAllChats() { const dbPairs = await db.forwardPair.findMany(); for (const forwardPair of dbPairs) { - const chatForUser = await this.tgUser.getChat(Number(forwardPair.tgChatId)) - if(chatForUser.entity instanceof Api.Chat){ + const chatForUser = await this.tgUser.getChat(Number(forwardPair.tgChatId)); + if (chatForUser.entity instanceof Api.Chat) { this.log.info('升级群组 ', chatForUser.id); await chatForUser.migrate(); }