koishi-plugin-aka-ai-generator 0.3.7 → 0.3.8
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 +26 -10
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1627,15 +1627,31 @@ Prompt: ${prompt}`);
|
|
|
1627
1627
|
if (!isAdmin(session.userId)) {
|
|
1628
1628
|
return "权限不足,仅管理员可操作";
|
|
1629
1629
|
}
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
const
|
|
1634
|
-
|
|
1635
|
-
|
|
1630
|
+
let useAll = options?.all;
|
|
1631
|
+
let inputContent = content;
|
|
1632
|
+
if (!useAll && inputContent) {
|
|
1633
|
+
const contentStr = typeof inputContent === "string" ? inputContent : inputContent ? import_koishi.h.select(import_koishi.h.parse(inputContent), "text").map((e) => e.attrs.content).join(" ") : "";
|
|
1634
|
+
if (contentStr && /-all\b/i.test(contentStr)) {
|
|
1635
|
+
useAll = true;
|
|
1636
|
+
inputContent = contentStr.replace(/-all\s*/gi, "").trim();
|
|
1637
|
+
}
|
|
1638
|
+
}
|
|
1639
|
+
if (useAll) {
|
|
1640
|
+
if (!inputContent || typeof inputContent === "string" && !inputContent.trim()) {
|
|
1641
|
+
inputContent = await getPromptInput(session, "请输入充值次数 [备注],例如:20 或 20 活动奖励");
|
|
1642
|
+
}
|
|
1643
|
+
if (!inputContent) return "输入超时或无效";
|
|
1644
|
+
let text2 = "";
|
|
1645
|
+
if (typeof inputContent === "string") {
|
|
1646
|
+
text2 = inputContent.trim();
|
|
1647
|
+
} else {
|
|
1648
|
+
const elements2 = import_koishi.h.parse(inputContent);
|
|
1649
|
+
const textElements2 = import_koishi.h.select(elements2, "text");
|
|
1650
|
+
text2 = textElements2.map((el) => el.attrs.content).join(" ").trim();
|
|
1651
|
+
}
|
|
1636
1652
|
const parts2 = text2.split(/\s+/).filter((p) => p);
|
|
1637
1653
|
if (parts2.length === 0) {
|
|
1638
|
-
return "
|
|
1654
|
+
return "请输入充值次数,例如:图像充值 -all 20";
|
|
1639
1655
|
}
|
|
1640
1656
|
const amount2 = parseInt(parts2[0]);
|
|
1641
1657
|
const note2 = parts2.slice(1).join(" ") || "全员充值";
|
|
@@ -1694,9 +1710,9 @@ Prompt: ${prompt}`);
|
|
|
1694
1710
|
return "充值失败,请稍后重试";
|
|
1695
1711
|
}
|
|
1696
1712
|
}
|
|
1697
|
-
const
|
|
1698
|
-
if (!
|
|
1699
|
-
const elements = import_koishi.h.parse(
|
|
1713
|
+
const rechargeContent = content || await getPromptInput(session, "请输入充值信息,格式:\n@用户1 @用户2 充值次数 [备注]");
|
|
1714
|
+
if (!rechargeContent) return "输入超时或无效";
|
|
1715
|
+
const elements = import_koishi.h.parse(rechargeContent);
|
|
1700
1716
|
const atElements = import_koishi.h.select(elements, "at");
|
|
1701
1717
|
const textElements = import_koishi.h.select(elements, "text");
|
|
1702
1718
|
const text = textElements.map((el) => el.attrs.content).join(" ").trim();
|