From 183a43548095895054d7141bfc4a6838bbc9abb2 Mon Sep 17 00:00:00 2001 From: Lex Lim Date: Mon, 18 Jul 2022 14:23:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=A2=91=E9=81=93=E8=AE=A2?= =?UTF-8?q?=E9=98=85=E5=A4=B1=E6=95=88=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/SubscribeManager.ts | 21 +++------------------ subscribe-example.yml | 4 ++-- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/src/SubscribeManager.ts b/src/SubscribeManager.ts index aef287c..63e63f3 100644 --- a/src/SubscribeManager.ts +++ b/src/SubscribeManager.ts @@ -38,6 +38,7 @@ export class SubscribeManager { this.subscribeConfig = {}; this.loadSubscribeFile(); + this.rebuildTree(); } public async initialize() { @@ -133,23 +134,7 @@ export class SubscribeManager { * @param channelId 频道ID */ public addChannel(channelId: string) { - this.subscribeList[channelId] = {}; - for (let robotId in this.subscribeConfig) { - this.prepareTree(robotId, channelId); // 这里就先创建tree - let targetConf = this.subscribeConfig[robotId]; - for (let targetType in targetConf) { - let targetList = targetConf[targetType]; - for (let targetIdentity in targetList) { - let subscribeChannelList = targetList[targetIdentity]; - if (subscribeChannelList.includes(channelId)) { - this.subscribeList[channelId][robotId].push({ - type: targetType, - identity: targetIdentity - }); - } - } - } - } + } /** @@ -157,7 +142,7 @@ export class SubscribeManager { * @param channelId 频道ID */ public removeChannel(channelId: string) { - delete this.subscribeList[channelId]; + } /** diff --git a/subscribe-example.yml b/subscribe-example.yml index 3c237b9..0e76668 100644 --- a/subscribe-example.yml +++ b/subscribe-example.yml @@ -1,9 +1,9 @@ qq: user: 1234567890: - - some_channel_group/* + - some_channel_group # 订阅频道组会订阅下一级的全部频道,但是不会订阅更深层级的频道 - some_channel_group2/some_channel group: 1234567890: - - some_channel_group/* + - some_channel_group - some_channel_group2/some_channel