koishi-plugin-cfmrmod 1.1.5 → 1.1.7
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/dist/index.js +10 -3
- package/dist/mcmod/plugin.js +1 -1
- package/dist/nlu.js +2 -2
- package/dist/notify.js +0 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -47,7 +47,7 @@ exports.Config = koishi_1.Schema.object({
|
|
|
47
47
|
cf: koishi_1.Schema.string().default('cf'),
|
|
48
48
|
mr: koishi_1.Schema.string().default('mr'),
|
|
49
49
|
cnmc: koishi_1.Schema.string().default('cnmc'),
|
|
50
|
-
}).description('指令前缀设置'),
|
|
50
|
+
}).default({ cf: 'cf', mr: 'mr', cnmc: 'cnmc' }).description('指令前缀设置'),
|
|
51
51
|
notify: koishi_1.Schema.object({
|
|
52
52
|
enabled: koishi_1.Schema.boolean().default(false).description('是否开启模组更新通知'),
|
|
53
53
|
interval: koishi_1.Schema.number().default(30 * 60 * 1000).description('轮询间隔(ms),默认 30 分钟'),
|
|
@@ -63,12 +63,19 @@ exports.Config = koishi_1.Schema.object({
|
|
|
63
63
|
interval: koishi_1.Schema.number().default(30 * 60 * 1000).description('单独轮询间隔(ms),默认 30 分钟,<= 0 禁用该订阅'),
|
|
64
64
|
})).role('table').default([]).description('订阅列表'),
|
|
65
65
|
})).role('table').default([]).description('通知群与订阅列表'),
|
|
66
|
+
}).default({
|
|
67
|
+
enabled: false,
|
|
68
|
+
interval: 30 * 60 * 1000,
|
|
69
|
+
adminAuthority: 3,
|
|
70
|
+
stateFile: 'data/cfmrmod_notify_state.json',
|
|
71
|
+
configFile: 'data/cfmrmod_notify_config.json',
|
|
72
|
+
groups: [],
|
|
66
73
|
}).description('—— 更新通知 ——'),
|
|
67
74
|
timeouts: koishi_1.Schema.number().default(60000).description('搜索会话超时时间(ms)'),
|
|
68
75
|
debug: koishi_1.Schema.boolean().default(false).description('开启调试日志'),
|
|
69
76
|
nlu: nlu.Config,
|
|
70
|
-
cfmr: cfmr.Config.description('CurseForge/Modrinth 搜索与图片卡片'),
|
|
71
|
-
mcmod: mcmod.Config.description('MCMod.cn 搜索与图片卡片'),
|
|
77
|
+
cfmr: cfmr.Config.default({}).description('CurseForge/Modrinth 搜索与图片卡片'),
|
|
78
|
+
mcmod: mcmod.Config.default({}).description('MCMod.cn 搜索与图片卡片'),
|
|
72
79
|
});
|
|
73
80
|
function apply(ctx, config) {
|
|
74
81
|
const logger = ctx.logger(exports.name);
|
package/dist/mcmod/plugin.js
CHANGED
|
@@ -15,7 +15,7 @@ const searchStates = new Map();
|
|
|
15
15
|
exports.name = 'mcmod-search';
|
|
16
16
|
exports.Config = Schema.object({
|
|
17
17
|
sendLink: Schema.boolean().default(true).description('发送卡片后是否附带链接'),
|
|
18
|
-
cookie: Schema.string().description('【可选】手动填写 mcmod.cn 的 Cookie'),
|
|
18
|
+
cookie: Schema.string().default('').description('【可选】手动填写 mcmod.cn 的 Cookie'),
|
|
19
19
|
autoCookie: Schema.boolean().default(false).description('自动从 cookie-manager 获取 mcmod.cn Cookie(存在该模块时生效)'),
|
|
20
20
|
cookieCheckInterval: Schema.number().default(30 * 60 * 1000).description('Cookie/Seed 检查间隔(ms)'),
|
|
21
21
|
fontPath: Schema.string().role('path').description('可选:自定义字体文件路径'),
|
package/dist/nlu.js
CHANGED
|
@@ -11,11 +11,11 @@ const DEFAULT_MODEL = 'gpt-4o-mini';
|
|
|
11
11
|
exports.Config = Schema.object({
|
|
12
12
|
enabled: Schema.boolean().default(false).description('启用 @机器人 自然语言查询入口'),
|
|
13
13
|
endpoint: Schema.string().default(DEFAULT_ENDPOINT).description('OpenAI 兼容 Chat Completions 接口地址'),
|
|
14
|
-
apiKey: Schema.string().
|
|
14
|
+
apiKey: Schema.string().default('').description('OpenAI 兼容接口 API Key'),
|
|
15
15
|
model: Schema.string().default(DEFAULT_MODEL).description('模型名称'),
|
|
16
16
|
timeout: Schema.number().default(15000).description('AI 请求超时(ms)'),
|
|
17
17
|
temperature: Schema.number().default(0).description('AI 温度参数'),
|
|
18
|
-
}).description('—— AI 自然语言理解 ——');
|
|
18
|
+
}).default({}).description('—— AI 自然语言理解 ——');
|
|
19
19
|
const PLATFORM_ALIASES = {
|
|
20
20
|
mcmod: 'mcmod', cnmc: 'mcmod', mc: 'mcmod', 'mcmod.cn': 'mcmod', 'mc百科': 'mcmod',
|
|
21
21
|
cf: 'cf', curseforge: 'cf', curse: 'cf',
|
package/dist/notify.js
CHANGED
|
@@ -252,13 +252,10 @@ function apply(ctx, config, options) {
|
|
|
252
252
|
const content = await fs_1.promises.readFile(filePath, 'utf8');
|
|
253
253
|
const json = JSON.parse(content);
|
|
254
254
|
if (json && typeof json === 'object') {
|
|
255
|
-
// 从文件加载时同步到 config 对象
|
|
256
255
|
if (typeof json.enabled === 'boolean')
|
|
257
256
|
config.enabled = json.enabled;
|
|
258
257
|
if (Array.isArray(json.groups))
|
|
259
258
|
config.groups = json.groups;
|
|
260
|
-
// 更新到 Koishi 配置系统
|
|
261
|
-
ctx.scope.update(config, false); // 不重载插件
|
|
262
259
|
}
|
|
263
260
|
if (!Array.isArray(config.groups))
|
|
264
261
|
config.groups = [];
|
|
@@ -275,9 +272,6 @@ function apply(ctx, config, options) {
|
|
|
275
272
|
// 确保 groups 数组存在
|
|
276
273
|
if (!Array.isArray(config.groups))
|
|
277
274
|
config.groups = [];
|
|
278
|
-
// 更新到 Koishi 配置系统,让修改反映到配置界面
|
|
279
|
-
ctx.scope.update(config, false); // 不重载插件,避免中断运行
|
|
280
|
-
// 同时保存到文件,保持 Koishi 配置和文件同步
|
|
281
275
|
const filePath = resolveConfigFile();
|
|
282
276
|
await fs_1.promises.mkdir(path_1.default.dirname(filePath), { recursive: true });
|
|
283
277
|
const obj = {
|