koishi-plugin-githubsth 1.0.1-test3 → 1.0.1-test4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +3 -3
- package/lib/services/notifier.js +6 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -53,6 +53,7 @@ exports.inject = {
|
|
|
53
53
|
};
|
|
54
54
|
__exportStar(require("./config"), exports);
|
|
55
55
|
function apply(ctx, config) {
|
|
56
|
+
console.log('[GithubSth] Plugin loading...');
|
|
56
57
|
// 本地化
|
|
57
58
|
ctx.i18n.define('zh-CN', zh_CN_1.default);
|
|
58
59
|
// 数据库
|
|
@@ -64,10 +65,9 @@ function apply(ctx, config) {
|
|
|
64
65
|
// admin and subscribe are already loaded in commands/index.ts, remove duplicate loading here
|
|
65
66
|
try {
|
|
66
67
|
ctx.plugin(commands, config);
|
|
67
|
-
|
|
68
|
-
console.log('githubsth plugin loaded');
|
|
68
|
+
console.log('[GithubSth] Plugin loaded successfully');
|
|
69
69
|
}
|
|
70
70
|
catch (e) {
|
|
71
|
-
console.error('
|
|
71
|
+
console.error('[GithubSth] Plugin failed to load:', e);
|
|
72
72
|
}
|
|
73
73
|
}
|
package/lib/services/notifier.js
CHANGED
|
@@ -22,6 +22,8 @@ class Notifier extends koishi_1.Service {
|
|
|
22
22
|
this.ctx.on('github/pull_request_review', (payload) => this.handleEvent('pull_request_review', payload));
|
|
23
23
|
}
|
|
24
24
|
async handleEvent(event, payload) {
|
|
25
|
+
// FORCE LOG for debugging
|
|
26
|
+
console.log(`[GithubSth] Received event: ${event}`);
|
|
25
27
|
let repoName = payload.repository?.full_name;
|
|
26
28
|
// Try to fallback if repoName is missing
|
|
27
29
|
if (!repoName && payload.issue?.repository_url) {
|
|
@@ -34,11 +36,13 @@ class Notifier extends koishi_1.Service {
|
|
|
34
36
|
repoName = payload.pull_request.base.repo.full_name;
|
|
35
37
|
}
|
|
36
38
|
if (!repoName) {
|
|
39
|
+
console.log(`[GithubSth] Missing repo info for event: ${event}`);
|
|
37
40
|
if (this.config.debug) {
|
|
38
41
|
this.ctx.logger('notifier').warn(`Event ${event} missing repository info. Keys: ${Object.keys(payload).join(', ')}`);
|
|
39
42
|
}
|
|
40
43
|
return;
|
|
41
44
|
}
|
|
45
|
+
console.log(`[GithubSth] Processing event ${event} for ${repoName}`);
|
|
42
46
|
if (this.config.debug) {
|
|
43
47
|
this.ctx.logger('notifier').info(`Received event ${event} for ${repoName}`);
|
|
44
48
|
this.ctx.logger('notifier').debug(JSON.stringify(payload, null, 2));
|
|
@@ -60,11 +64,13 @@ class Notifier extends koishi_1.Service {
|
|
|
60
64
|
return true;
|
|
61
65
|
});
|
|
62
66
|
if (matchedRules.length === 0) {
|
|
67
|
+
console.log(`[GithubSth] No matching rules for ${repoName}`);
|
|
63
68
|
if (this.config.debug) {
|
|
64
69
|
this.ctx.logger('notifier').debug(`No matching rules for ${repoName} (event: ${event})`);
|
|
65
70
|
}
|
|
66
71
|
return;
|
|
67
72
|
}
|
|
73
|
+
console.log(`[GithubSth] Found ${matchedRules.length} matching rules for ${repoName}`);
|
|
68
74
|
if (this.config.debug) {
|
|
69
75
|
this.ctx.logger('notifier').debug(`Found ${matchedRules.length} matching rules for ${repoName}`);
|
|
70
76
|
}
|
package/package.json
CHANGED