koishi-plugin-githubsth 1.0.1-test5 → 1.0.1-test7
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 +21 -0
- package/lib/services/formatter.js +1 -0
- package/lib/services/notifier.js +5 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -60,8 +60,29 @@ function apply(ctx, config) {
|
|
|
60
60
|
// 数据库
|
|
61
61
|
ctx.plugin(database);
|
|
62
62
|
// 注册服务
|
|
63
|
+
logger.info('Registering Formatter...');
|
|
63
64
|
ctx.plugin(formatter_1.Formatter);
|
|
65
|
+
logger.info('Registering Notifier...');
|
|
64
66
|
ctx.plugin(notifier_1.Notifier, config);
|
|
67
|
+
// Debug listener for raw events
|
|
68
|
+
ctx.on('github/issues', (payload) => {
|
|
69
|
+
logger.info('[DEBUG] Global listener caught github/issues');
|
|
70
|
+
});
|
|
71
|
+
ctx.on('github/opened', (payload) => {
|
|
72
|
+
logger.info('[DEBUG] Global listener caught github/opened');
|
|
73
|
+
});
|
|
74
|
+
// Comprehensive debug listeners
|
|
75
|
+
ctx.on('github/webhook', (payload) => {
|
|
76
|
+
logger.info('[DEBUG] Global listener caught github/webhook');
|
|
77
|
+
});
|
|
78
|
+
// Middleware to log all sessions
|
|
79
|
+
ctx.middleware((session, next) => {
|
|
80
|
+
// Log any session event from github
|
|
81
|
+
if (session.platform === 'github') {
|
|
82
|
+
logger.info(`[DEBUG] Middleware saw session.type: ${session.type}, subtype: ${session.subtype}`);
|
|
83
|
+
}
|
|
84
|
+
return next();
|
|
85
|
+
});
|
|
65
86
|
// 注册命令
|
|
66
87
|
// admin and subscribe are already loaded in commands/index.ts, remove duplicate loading here
|
|
67
88
|
try {
|
|
@@ -5,6 +5,7 @@ const koishi_1 = require("koishi");
|
|
|
5
5
|
class Formatter extends koishi_1.Service {
|
|
6
6
|
constructor(ctx) {
|
|
7
7
|
super(ctx, 'githubsthFormatter');
|
|
8
|
+
ctx.logger('githubsth').info('Formatter service initialized');
|
|
8
9
|
}
|
|
9
10
|
formatPush(payload) {
|
|
10
11
|
const { repository, pusher, commits, compare } = payload;
|
package/lib/services/notifier.js
CHANGED
|
@@ -7,19 +7,24 @@ class Notifier extends koishi_1.Service {
|
|
|
7
7
|
constructor(ctx, config) {
|
|
8
8
|
super(ctx, 'githubsthNotifier', true);
|
|
9
9
|
this.config = config;
|
|
10
|
+
this.ctx.logger('githubsth').info('Notifier service initialized');
|
|
10
11
|
this.registerListeners();
|
|
11
12
|
}
|
|
12
13
|
registerListeners() {
|
|
13
14
|
this.ctx.on('github/push', (payload) => this.handleEvent('push', payload));
|
|
14
15
|
this.ctx.on('github/issues', (payload) => this.handleEvent('issues', payload));
|
|
15
16
|
this.ctx.on('github/pull_request', (payload) => this.handleEvent('pull_request', payload));
|
|
17
|
+
this.ctx.on('github/pull-request', (payload) => this.handleEvent('pull_request', payload));
|
|
16
18
|
this.ctx.on('github/star', (payload) => this.handleEvent('star', payload));
|
|
17
19
|
this.ctx.on('github/fork', (payload) => this.handleEvent('fork', payload));
|
|
18
20
|
this.ctx.on('github/release', (payload) => this.handleEvent('release', payload));
|
|
19
21
|
this.ctx.on('github/discussion', (payload) => this.handleEvent('discussion', payload));
|
|
20
22
|
this.ctx.on('github/workflow_run', (payload) => this.handleEvent('workflow_run', payload));
|
|
23
|
+
this.ctx.on('github/workflow-run', (payload) => this.handleEvent('workflow_run', payload));
|
|
21
24
|
this.ctx.on('github/issue_comment', (payload) => this.handleEvent('issue_comment', payload));
|
|
25
|
+
this.ctx.on('github/issue-comment', (payload) => this.handleEvent('issue_comment', payload));
|
|
22
26
|
this.ctx.on('github/pull_request_review', (payload) => this.handleEvent('pull_request_review', payload));
|
|
27
|
+
this.ctx.on('github/pull-request-review', (payload) => this.handleEvent('pull_request_review', payload));
|
|
23
28
|
}
|
|
24
29
|
async handleEvent(event, payload) {
|
|
25
30
|
// FORCE LOG for debugging
|
package/package.json
CHANGED