koishi-plugin-githubsth 1.0.1-test2 → 1.0.1-test3
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.
|
@@ -4,7 +4,7 @@ exports.Formatter = void 0;
|
|
|
4
4
|
const koishi_1 = require("koishi");
|
|
5
5
|
class Formatter extends koishi_1.Service {
|
|
6
6
|
constructor(ctx) {
|
|
7
|
-
super(ctx, '
|
|
7
|
+
super(ctx, 'githubsthFormatter');
|
|
8
8
|
}
|
|
9
9
|
formatPush(payload) {
|
|
10
10
|
const { repository, pusher, commits, compare } = payload;
|
package/lib/services/notifier.js
CHANGED
|
@@ -5,7 +5,7 @@ const koishi_1 = require("koishi");
|
|
|
5
5
|
class Notifier extends koishi_1.Service {
|
|
6
6
|
// @ts-ignore
|
|
7
7
|
constructor(ctx, config) {
|
|
8
|
-
super(ctx, '
|
|
8
|
+
super(ctx, 'githubsthNotifier', true);
|
|
9
9
|
this.config = config;
|
|
10
10
|
this.registerListeners();
|
|
11
11
|
}
|
|
@@ -70,40 +70,40 @@ class Notifier extends koishi_1.Service {
|
|
|
70
70
|
}
|
|
71
71
|
let message = null;
|
|
72
72
|
// Ensure formatter is loaded
|
|
73
|
-
if (!this.ctx.
|
|
73
|
+
if (!this.ctx.githubsthFormatter) {
|
|
74
74
|
this.ctx.logger('notifier').warn('Formatter service not available');
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
77
77
|
switch (event) {
|
|
78
78
|
case 'push':
|
|
79
|
-
message = this.ctx.
|
|
79
|
+
message = this.ctx.githubsthFormatter.formatPush(payload);
|
|
80
80
|
break;
|
|
81
81
|
case 'issues':
|
|
82
|
-
message = this.ctx.
|
|
82
|
+
message = this.ctx.githubsthFormatter.formatIssue(payload);
|
|
83
83
|
break;
|
|
84
84
|
case 'pull_request':
|
|
85
|
-
message = this.ctx.
|
|
85
|
+
message = this.ctx.githubsthFormatter.formatPullRequest(payload);
|
|
86
86
|
break;
|
|
87
87
|
case 'star':
|
|
88
|
-
message = this.ctx.
|
|
88
|
+
message = this.ctx.githubsthFormatter.formatStar(payload);
|
|
89
89
|
break;
|
|
90
90
|
case 'fork':
|
|
91
|
-
message = this.ctx.
|
|
91
|
+
message = this.ctx.githubsthFormatter.formatFork(payload);
|
|
92
92
|
break;
|
|
93
93
|
case 'release':
|
|
94
|
-
message = this.ctx.
|
|
94
|
+
message = this.ctx.githubsthFormatter.formatRelease(payload);
|
|
95
95
|
break;
|
|
96
96
|
case 'discussion':
|
|
97
|
-
message = this.ctx.
|
|
97
|
+
message = this.ctx.githubsthFormatter.formatDiscussion(payload);
|
|
98
98
|
break;
|
|
99
99
|
case 'workflow_run':
|
|
100
|
-
message = this.ctx.
|
|
100
|
+
message = this.ctx.githubsthFormatter.formatWorkflowRun(payload);
|
|
101
101
|
break;
|
|
102
102
|
case 'issue_comment':
|
|
103
|
-
message = this.ctx.
|
|
103
|
+
message = this.ctx.githubsthFormatter.formatIssueComment(payload);
|
|
104
104
|
break;
|
|
105
105
|
case 'pull_request_review':
|
|
106
|
-
message = this.ctx.
|
|
106
|
+
message = this.ctx.githubsthFormatter.formatPullRequestReview(payload);
|
|
107
107
|
break;
|
|
108
108
|
}
|
|
109
109
|
if (!message) {
|
package/package.json
CHANGED