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