koishi-plugin-ccb-plus 1.0.5 → 1.0.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/lib/index.js +19 -6
- package/package.json +1 -1
- 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
|
|
394
|
-
|
|
395
|
-
|
|
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()) {
|
|
@@ -448,7 +461,7 @@ function applyCcbCommand(ctx, config, state) {
|
|
|
448
461
|
const senderOptOut = senderSetting?.optOut ?? config.defaultOptOut;
|
|
449
462
|
const senderIsInitial = !senderSetting;
|
|
450
463
|
if (senderOptOut) {
|
|
451
|
-
const message2 = senderIsInitial ? "你还未开启ccb功能。请先使用 ccb --on 来开启。" : "你已开启保护模式,无法ccb他人。请先使用 ccb --on 解除保护。";
|
|
464
|
+
const message2 = senderIsInitial ? "❌ 你还未开启ccb功能。请先使用 /ccb --on 来开启。" : "❌ 你已开启保护模式,无法ccb他人。请先使用 /ccb --on 解除保护。";
|
|
452
465
|
return message2;
|
|
453
466
|
}
|
|
454
467
|
const actorId = senderId;
|
|
@@ -501,7 +514,7 @@ function applyCcbCommand(ctx, config, state) {
|
|
|
501
514
|
}
|
|
502
515
|
if (overrides[actorId] !== true && targetOptOut) {
|
|
503
516
|
const nickname = await state.getUserNickname(session, targetUserId) || targetUserId;
|
|
504
|
-
const message2 = isInitialState ? `${nickname} 还未开启ccb功能。请让ta使用 ccb --on 来开启。` : `${nickname} 已开启保护模式,拒绝了和你ccb。请让ta使用 ccb --on 来允许被ccb。`;
|
|
517
|
+
const message2 = isInitialState ? `${nickname} 还未开启ccb功能。请让ta使用 /ccb --on 来开启。` : `${nickname} 已开启保护模式,拒绝了和你ccb。请让ta使用 /ccb --on 来允许被ccb。`;
|
|
505
518
|
return message2;
|
|
506
519
|
}
|
|
507
520
|
if (targetUserId === actorId && !config.selfCcb) {
|
package/package.json
CHANGED
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 协助开发
|