mioku-plugin-help 3.0.3 → 3.0.4
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/help/role.ts +2 -2
- package/index.ts +20 -3
- package/package.json +1 -13
package/help/role.ts
CHANGED
|
@@ -33,7 +33,7 @@ export function canInvokeCommand(
|
|
|
33
33
|
* Resolve the requesting user's effective role for help filtering.
|
|
34
34
|
*
|
|
35
35
|
* - `master` is honored everywhere (private or group) — it comes from
|
|
36
|
-
* mioki's `
|
|
36
|
+
* mioki's `isMaster` allowlist (the bot `owners` list).
|
|
37
37
|
* - Private chat skips the `isAdmin` check and defaults to `admin`,
|
|
38
38
|
* so anyone DM-ing the bot can see admin-level commands.
|
|
39
39
|
* - Group chat resolves bot admin (mioki `isAdmin` allowlist), group
|
|
@@ -49,7 +49,7 @@ export async function resolveViewerRole(
|
|
|
49
49
|
ctx: any,
|
|
50
50
|
event: any,
|
|
51
51
|
): Promise<CommandRole> {
|
|
52
|
-
if (ctx?.
|
|
52
|
+
if (ctx?.isMaster?.(event)) {
|
|
53
53
|
return "master";
|
|
54
54
|
}
|
|
55
55
|
|
package/index.ts
CHANGED
|
@@ -21,8 +21,6 @@ import { createHelpSkills } from "./skills";
|
|
|
21
21
|
|
|
22
22
|
const helpPlugin = definePlugin({
|
|
23
23
|
name: "help",
|
|
24
|
-
version: "2.1.0",
|
|
25
|
-
description: "帮助插件,生成帮助图片,并提供 #状态 指令",
|
|
26
24
|
|
|
27
25
|
async setup(ctx: MiokuContext) {
|
|
28
26
|
// 启动后台采样器
|
|
@@ -75,7 +73,7 @@ const helpPlugin = definePlugin({
|
|
|
75
73
|
for (const skill of createHelpSkills()) aiService.registerSkill(skill);
|
|
76
74
|
}
|
|
77
75
|
|
|
78
|
-
|
|
76
|
+
const handleHelpMessage = async (event: import("mioku").MessageEvent) => {
|
|
79
77
|
const text = ctx.text(event);
|
|
80
78
|
if (!text) {
|
|
81
79
|
return;
|
|
@@ -155,6 +153,25 @@ const helpPlugin = definePlugin({
|
|
|
155
153
|
ctx.logger.error(`生成帮助图片失败: ${error}`);
|
|
156
154
|
await event.reply(`生成帮助图片失败: ${error}`);
|
|
157
155
|
}
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
ctx.command({
|
|
159
|
+
id: "帮助菜单",
|
|
160
|
+
name: "help",
|
|
161
|
+
aliases: ["帮助", "菜单"],
|
|
162
|
+
match: /^(?:help|帮助|菜单)(?:\s|$)/i,
|
|
163
|
+
prefixes: ["#", "/", ""],
|
|
164
|
+
description: "生成帮助图片",
|
|
165
|
+
handler: ({ event }) => handleHelpMessage(event),
|
|
166
|
+
});
|
|
167
|
+
ctx.command({
|
|
168
|
+
id: "status",
|
|
169
|
+
name: "status",
|
|
170
|
+
aliases: ["状态", "zt"],
|
|
171
|
+
match: /^(?:status|状态|zt)(?:\s|$)/i,
|
|
172
|
+
prefixes: ["#", "/", ""],
|
|
173
|
+
description: "生成系统状态图片",
|
|
174
|
+
handler: ({ event }) => handleHelpMessage(event),
|
|
158
175
|
});
|
|
159
176
|
|
|
160
177
|
return () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mioku-plugin-help",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.4",
|
|
4
4
|
"description": "帮助插件,使用截图服务生成美观的帮助图片,并提供 #状态 指令",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -17,18 +17,6 @@
|
|
|
17
17
|
"screenshot",
|
|
18
18
|
"config",
|
|
19
19
|
"ai"
|
|
20
|
-
],
|
|
21
|
-
"accessHooks": [
|
|
22
|
-
{
|
|
23
|
-
"id": "帮助菜单",
|
|
24
|
-
"match": "/(?:[#/]\\s*(?:帮助|菜单|help)|^(?:帮助|菜单|help)(?:\\s|$))/",
|
|
25
|
-
"description": "匹配 #help / 帮助 / 菜单 等帮助指令"
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
"id": "状态",
|
|
29
|
-
"match": "/(?:[#/]\\s*(?:状态|zt|status)|^(?:状态|zt|status)(?:\\s|$))/",
|
|
30
|
-
"description": "匹配 #状态 / 状态 / zt / status 等系统状态指令"
|
|
31
|
-
}
|
|
32
20
|
]
|
|
33
21
|
},
|
|
34
22
|
"peerDependencies": {
|