koishi-plugin-cat-raising 0.0.1 → 0.0.3
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 +11 -5
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -30,7 +30,7 @@ var name = "cat-raising";
|
|
|
30
30
|
var Config = import_koishi.Schema.object({
|
|
31
31
|
targetQQ: import_koishi.Schema.string().description("目标QQ号或QQ群号").required(),
|
|
32
32
|
isGroup: import_koishi.Schema.boolean().description("是否为QQ群").default(false),
|
|
33
|
-
debugMode: import_koishi.Schema.boolean().description("
|
|
33
|
+
debugMode: import_koishi.Schema.boolean().description("调试模式(不执行转发,仅在原消息处发送调试信息)").default(false)
|
|
34
34
|
});
|
|
35
35
|
function apply(ctx, config) {
|
|
36
36
|
ctx.on("message", (session) => {
|
|
@@ -38,16 +38,22 @@ function apply(ctx, config) {
|
|
|
38
38
|
if (!message.includes("神金")) return;
|
|
39
39
|
const numberRegex = /\d{6,15}/;
|
|
40
40
|
if (!numberRegex.test(message)) return;
|
|
41
|
+
if (config.debugMode) {
|
|
42
|
+
const debugMessage = `🐱 调试模式 - 检测到神金
|
|
43
|
+
📤 转发目标: ${config.targetQQ}${config.isGroup ? " (群聊)" : ""}
|
|
44
|
+
💬 检测内容: ${message}
|
|
45
|
+
🔍 匹配数字: ${message.match(/\d{6,15}/)?.[0] || "未找到"}
|
|
46
|
+
✅ 条件满足,但调试模式下不执行转发`;
|
|
47
|
+
session.send(debugMessage);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
41
50
|
const forwardMessage = message;
|
|
42
51
|
if (config.isGroup) {
|
|
43
52
|
session.bot.sendMessage(config.targetQQ, forwardMessage);
|
|
44
53
|
} else {
|
|
45
54
|
session.bot.sendPrivateMessage(config.targetQQ, forwardMessage);
|
|
46
55
|
}
|
|
47
|
-
|
|
48
|
-
📤 转发目标: ${config.targetQQ}${config.isGroup ? " (群聊)" : ""}
|
|
49
|
-
💬 转发内容: ${forwardMessage}` : "🐱 检测到神金 已执行转发~";
|
|
50
|
-
session.send(replyMessage);
|
|
56
|
+
session.send("🐱 检测到神金 已执行转发~");
|
|
51
57
|
});
|
|
52
58
|
}
|
|
53
59
|
__name(apply, "apply");
|