From 183a43548095895054d7141bfc4a6838bbc9abb2 Mon Sep 17 00:00:00 2001 From: Lex Lim Date: Mon, 18 Jul 2022 14:23:11 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=A2=91=E9=81=93?= =?UTF-8?q?=E8=AE=A2=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 From df84d88adf0e1c042ae7f7d2a04247db61eed22c Mon Sep 17 00:00:00 2001 From: Lex Lim Date: Mon, 15 Aug 2022 15:21:17 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9C=BA=E5=99=A8?= =?UTF-8?q?=E4=BA=BA=E6=8E=A5=E5=8F=A3=E5=8F=91=E9=80=81=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E6=97=B6=E5=BC=82=E5=B8=B8=E9=80=80=E5=87=BA?= =?UTF-8?q?=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/RobotManager.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/RobotManager.ts b/src/RobotManager.ts index 6a7cc77..7b13a52 100644 --- a/src/RobotManager.ts +++ b/src/RobotManager.ts @@ -93,7 +93,7 @@ export class RobotManager { } try { - robot.sendMessage(targets, currentMsg); + await robot.sendMessage(targets, currentMsg); } catch(err) { console.error(`[${channelId}] 无法发送消息到 ${robotId} : `, err); } From 961b9bc86cb5c2a1e9a52d9f3a5b21f75c75e9d5 Mon Sep 17 00:00:00 2001 From: Lex Lim Date: Wed, 21 Sep 2022 13:43:52 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=8D=8F=E8=AE=AE?= =?UTF-8?q?=E5=88=B0go-cqhttp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- channels/isekaiwiki/admin/autoReview.yml | 6 +++--- channels/isekaiwiki/admin/needReview.yml | 4 ++-- channels/isekaiwiki/editPage.yml | 6 +++--- channels/isekaiwiki/newPage.yml | 6 +++--- src/robot/QQRobot.ts | 6 ++---- 5 files changed, 13 insertions(+), 15 deletions(-) diff --git a/channels/isekaiwiki/admin/autoReview.yml b/channels/isekaiwiki/admin/autoReview.yml index 95b1e86..25ebaa9 100644 --- a/channels/isekaiwiki/admin/autoReview.yml +++ b/channels/isekaiwiki/admin/autoReview.yml @@ -6,6 +6,6 @@ source: type: autoReview tpl: default: |- - {{data.author}} 更新了新页面: {{data.title}} - {{data.summary}} - {{data.result}} + {{{author}}} 更新了新页面: {{{title}}} + {{{summary}}} + {{{result}}} diff --git a/channels/isekaiwiki/admin/needReview.yml b/channels/isekaiwiki/admin/needReview.yml index 0ef04fe..196ce64 100644 --- a/channels/isekaiwiki/admin/needReview.yml +++ b/channels/isekaiwiki/admin/needReview.yml @@ -7,5 +7,5 @@ source: tpl: default: |- Review队列更新: - {{data.author}} 更新了新页面: {{data.title}} - {{data.summary}} + {{{author}}} 更新了页面: {{{title}}} + {{{summary}}} diff --git a/channels/isekaiwiki/editPage.yml b/channels/isekaiwiki/editPage.yml index 3b2a693..5d1a120 100644 --- a/channels/isekaiwiki/editPage.yml +++ b/channels/isekaiwiki/editPage.yml @@ -6,6 +6,6 @@ source: type: edit tpl: default: |- - {{data.author}} 更新了页面: {{data.title}} - {{data.summary}} - {{data.url}} + {{{author}}} 更新了页面: {{{title}}} + {{{summary}}} + {{{url}}} diff --git a/channels/isekaiwiki/newPage.yml b/channels/isekaiwiki/newPage.yml index 867490c..e6b4986 100644 --- a/channels/isekaiwiki/newPage.yml +++ b/channels/isekaiwiki/newPage.yml @@ -6,6 +6,6 @@ source: type: new tpl: default: |- - {{data.author}} 创建了新页面: {{data.title}} - {{data.summary}} - {{data.url}} + {{{author}}} 创建了新页面: {{{title}}} + {{{summary}}} + {{{url}}} diff --git a/src/robot/QQRobot.ts b/src/robot/QQRobot.ts index f55a8f8..28a930c 100644 --- a/src/robot/QQRobot.ts +++ b/src/robot/QQRobot.ts @@ -45,9 +45,8 @@ export default class QQRobot implements Robot { } return await this.doApiRequest('send_private_msg', { - bot_id: this.botQQ, user_id: user, - message: message, + message: message }); } @@ -64,9 +63,8 @@ export default class QQRobot implements Robot { } return await this.doApiRequest('send_group_msg', { - bot_id: this.botQQ, group_id: group, - message: message, + message: message }); } From 29713ec7d6a8284909849459b9353cf108ffcaa1 Mon Sep 17 00:00:00 2001 From: Lex Lim Date: Tue, 7 Feb 2023 13:43:18 +0000 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dexcerpt=E4=B8=8D=E8=B5=B7?= =?UTF-8?q?=E4=BD=9C=E7=94=A8=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/Setup.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Setup.ts b/src/Setup.ts index cc66384..6c54812 100644 --- a/src/Setup.ts +++ b/src/Setup.ts @@ -10,8 +10,9 @@ export class Setup { let maxLength: any = parseInt(args[1]); let ellipsis: any = undefined; if (args.length > 3) { - return Utils.excerpt(text, parseInt(maxLength), ellipsis); + ellipsis = args[2]; } + return Utils.excerpt(text, parseInt(maxLength), ellipsis); } return args[0]; });