koishi-plugin-ccb-plus 1.0.5 → 1.0.6

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.
Files changed (3) hide show
  1. package/lib/index.js +17 -4
  2. package/package.json +1 -1
  3. package/readme.md +16 -12
package/lib/index.js CHANGED
@@ -389,10 +389,23 @@ function applyCcbCommand(ctx, config, state) {
389
389
  if (typeof optionVal === "string" && optionVal.trim()) {
390
390
  targetUserStr = await state.findTargetUser(session, optionVal.trim());
391
391
  }
392
- if (!targetUserStr) {
393
- const atEl = session.elements?.find((el) => el.type === "at");
394
- if (atEl?.attrs?.id) {
395
- targetUserStr = String(atEl.attrs.id);
392
+ if (!targetUserStr && session.elements) {
393
+ const optionFlag = isOff ? "--off" : "--on";
394
+ const els = session.elements;
395
+ for (let i = 0; i < els.length; i++) {
396
+ if (els[i].type === "text" && els[i].attrs?.content?.includes(optionFlag)) {
397
+ const textAfterFlag = els[i].attrs.content.split(optionFlag).pop() || "";
398
+ if (!textAfterFlag.trim() && i + 1 < els.length) {
399
+ for (let j = i + 1; j < els.length; j++) {
400
+ if (els[j].type === "at" && els[j].attrs?.id) {
401
+ targetUserStr = String(els[j].attrs.id);
402
+ break;
403
+ }
404
+ if (els[j].type === "text" && els[j].attrs?.content?.trim()) break;
405
+ }
406
+ }
407
+ break;
408
+ }
396
409
  }
397
410
  }
398
411
  if (!targetUserStr && typeof optionVal === "string" && optionVal.trim()) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-ccb-plus",
3
3
  "description": "Koishi 插件,与群友发生 ccb 行为。(移植自 astrbot_plugin_ccb_plus )",
4
- "version": "1.0.5",
4
+ "version": "1.0.6",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [
package/readme.md CHANGED
@@ -44,11 +44,18 @@ npm install koishi-plugin-ccb-plus
44
44
 
45
45
  ### 管理功能
46
46
 
47
- 管理员可以在插件配置界面使用"重置所有用户状态"功能:
48
- - 选择"重置为开放模式" - 一键将所有用户的全局状态设为开放
49
- - 选择"重置为保护模式" - 一键将所有用户的全局状态设为保护
47
+ 管理员可以在插件配置界面进行批量管理:
50
48
 
51
- **说明:** 重置功能只影响全局状态,用户的针对性设置不受影响。
49
+ **批量操作:**
50
+ - 无操作 - 默认选项,操作完成后请改回此项
51
+ - 重置为开放模式 - 将所有用户的全局状态设为开放
52
+ - 重置为保护模式 - 将所有用户的全局状态设为保护
53
+ - 清空所有设置 - 删除所有用户的设置记录,恢复初始状态
54
+
55
+ **说明:**
56
+ - 重置操作只影响全局状态,用户的针对性设置不受影响
57
+ - 清空操作会删除所有设置,包括针对性设置
58
+ - 操作完成后请将选项改回"无操作",避免重复执行
52
59
 
53
60
  ## 配置项
54
61
 
@@ -56,17 +63,14 @@ npm install koishi-plugin-ccb-plus
56
63
  |--------|------|--------|------|
57
64
  | `selfCcb` | boolean | false | 是否允许自己 ccb 自己 |
58
65
  | `critProb` | number | 0.1 | 暴击概率 (0-1) |
59
- | `ywWindow` | number | 60 | 阳痿检测时间窗口(秒)|
60
- | `ywThreshold` | number | 5 | 阳痿检测次数阈值 |
61
- | `ywBanDuration` | number | 300 | 阳痿惩罚时长(秒)|
66
+ | `ywWindow` | number | 60 | 冷却检测时间窗口(秒)|
67
+ | `ywThreshold` | number | 5 | 冷却检测次数阈值 |
68
+ | `ywBanDuration` | number | 300 | 冷却时长(秒)|
62
69
  | `ywProbability` | number | 0.05 | 炸膛概率 (0-1) |
63
70
  | `toggleCooldown` | number | 10 | 开关冷却时间(秒)|
64
71
  | `whiteList` | string[] | [] | 永久保护名单(用户ID)|
65
-
66
- ## 许可证
67
-
68
- MIT
72
+ | `defaultOptOut` | boolean | true | 新用户默认状态(true=保护,false=开放)|
69
73
 
70
74
  ---
71
75
 
72
- > 使用 Claude Opus 4.6 协助开发
76
+ > 使用 Claude Opus 4.6 协助开发