Skip to content

Commit 217477b

Browse files
committed
♻️ refactor: 更新 koishi-plugin-adapter-github 依赖为补丁版本,并修改 .gitignore 文件
1 parent b3cfe42 commit 217477b

5 files changed

Lines changed: 39 additions & 5 deletions

File tree

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ tsconfig.tsbuildinfo
2929
*.ntvs*
3030
*.njsproj
3131
*.sln
32-
.yarn
3332
.vscode
3433
.env
3534
mir.py
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
diff --git a/lib/config.d.ts b/lib/config.d.ts
2+
index e399ebc7544a3fdffe9f0be61f9ada79afed7b14..955d4d155244c50aa0e584dca915bfa1cd6d1b8e 100644
3+
--- a/lib/config.d.ts
4+
+++ b/lib/config.d.ts
5+
@@ -17,6 +17,7 @@ export interface Config {
6+
proxyUrl?: string;
7+
loggerinfo?: boolean;
8+
silentMode?: boolean;
9+
+ ignoreBotSelf?: boolean;
10+
maxRetries?: number;
11+
ignoreNetworkWarnings?: boolean;
12+
}
13+
diff --git a/lib/index.js b/lib/index.js
14+
index bb6fa705a2722ed966fac61e2d84a2b09c4aeb1e..98307a13c040988074cf705034f0032482d683c8 100644
15+
--- a/lib/index.js
16+
+++ b/lib/index.js
17+
@@ -1274,7 +1274,8 @@ var Config = import_koishi3.Schema.intersect([
18+
}).description("网络重试设置"),
19+
import_koishi3.Schema.object({
20+
silentMode: import_koishi3.Schema.boolean().default(false).description("是否以静默模式运行?<br>开启后,不会向 GitHub 发送任何可见内容,包括 send、sendMessage 等方法都不再可用,仅单向接收 GitHub 消息、响应必要的 webhook ping 事件。"),
21+
- ignoreNetworkWarnings: import_koishi3.Schema.boolean().default(true).description("是否忽略网络重试警告日志<br>开启后,网络临时故障(如超时、连接重置等)的重试日志将不会显示,只保留严重错误日志")
22+
+ ignoreNetworkWarnings: import_koishi3.Schema.boolean().default(true).description("是否忽略网络重试警告日志<br>开启后,网络临时故障(如超时、连接重置等)的重试日志将不会显示,只保留严重错误日志"),
23+
+ ignoreBotSelf: import_koishi3.Schema.boolean().default(true).description("是否忽略自己触发的事件<br>开启后,机器人自己发起的操作(如创建评论、触发工作流等)所产生的事件将不会被处理,避免死循环和不必要的处理开销")
24+
}).description("静默模式"),
25+
import_koishi3.Schema.object({
26+
loggerinfo: import_koishi3.Schema.boolean().default(false).description("日志调试模式").experimental()
27+
@@ -1694,7 +1695,7 @@ __name(parseInlineMarkdown, "parseInlineMarkdown");
28+
// src/bot/event/session.ts
29+
async function handleGitHubEvent(bot, event, owner, repo) {
30+
const actorLogin = event.actor?.login || event.actor?.name;
31+
- if (actorLogin === bot.selfId) {
32+
+ if (bot.config.ignoreBotSelf && actorLogin === bot.selfId) {
33+
bot.logInfo(`忽略机器人自己产生的事件: ${event.type}`);
34+
return;
35+
}

external/notice/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@
2222
"octokit": "^4.0.2"
2323
},
2424
"devDependencies": {
25-
"koishi-plugin-adapter-github": "^1.1.2"
25+
"koishi-plugin-adapter-github": "patch:koishi-plugin-adapter-github@npm%3A1.1.2#~/.yarn/patches/koishi-plugin-adapter-github-npm-1.1.2-8ac8377055.patch"
2626
}
2727
}

external/notice/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ async function formatLeafBuildMessage() {
3434
});
3535

3636
const jarAsset = releaseData.assets?.find((asset) =>
37-
/^leaf-.+-\d+\.jar$/i.test(asset.name)
37+
/^leaf-.+-\d+\.jar$/i.test(asset.name),
3838
);
3939

4040
const tagVersion = (releaseData.tag_name || "").replace(/^ver\//, "");
@@ -117,7 +117,7 @@ export function apply(ctx: Context, config: Config) {
117117
ctx.on("github/push", async (event: GitHubPushEvent) => {
118118
if (event.repo !== "Leaf" || !config.groups.length) return;
119119

120-
const branch = event.ref?.replace(/^refs\/heads\//, "") || "";
120+
const branch = event.ref?.replace(/^refs\/tags\//, "") || "";
121121
if (!branch.startsWith("ver/")) return;
122122

123123
const bot = ctx.bots[config.botSid];

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"@koishijs/plugin-status": "^7.4.10",
6565
"@mrlingxd/koishi-plugin-adapter-onebot": "0.2.10",
6666
"koishi": "^4.18.11",
67-
"koishi-plugin-adapter-github": "1.1.2",
67+
"koishi-plugin-adapter-github": "patch:koishi-plugin-adapter-github@npm%3A1.1.2#~/.yarn/patches/koishi-plugin-adapter-github-npm-1.1.2-8ac8377055.patch",
6868
"koishi-plugin-assets-local": "^3.3.2",
6969
"koishi-plugin-dataview": "^2.7.8",
7070
"koishi-plugin-desktop": "^1.0.0",

0 commit comments

Comments
 (0)