koishi-plugin-hhs-huatu 0.3.1 → 0.3.2
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 +18 -5
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -3246,9 +3246,6 @@ function apply(ctx, config) {
|
|
|
3246
3246
|
resolve: /* @__PURE__ */ __name((value) => {
|
|
3247
3247
|
queueSystem.userTasks[currentUserId]--;
|
|
3248
3248
|
targetBot.sendMessage(targetChannelId, value);
|
|
3249
|
-
if (config.membershipEnabled) {
|
|
3250
|
-
membershipSystem.incrementUsage(currentUserId, 1);
|
|
3251
|
-
}
|
|
3252
3249
|
if (Array.isArray(ctx.config.token)) {
|
|
3253
3250
|
if (config.tokenStrategy === "parallel" && ctx.runtime?.tokenUsage) {
|
|
3254
3251
|
const usedTokens = Object.entries(ctx.runtime.tokenUsage).filter(([_, used]) => used).map(([index2]) => index2);
|
|
@@ -3493,13 +3490,29 @@ function apply(ctx, config) {
|
|
|
3493
3490
|
]);
|
|
3494
3491
|
});
|
|
3495
3492
|
if (config.memberDebugCommandEnabled) {
|
|
3496
|
-
ctx.command("novelai.member-debug", "会员系统调试指令").userFields(["authority"]).alias("会员调试").option("cleanup", "-c 立即执行会员信息清理").option("remind", "-r 立即执行会员到期提醒").option("status", "-s 查看定时任务状态").action(async ({ session, options: options2 }) => {
|
|
3493
|
+
ctx.command("novelai.member-debug", "会员系统调试指令").userFields(["authority"]).alias("会员调试").option("cleanup", "-c 立即执行会员信息清理").option("remind", "-r 立即执行会员到期提醒").option("status", "-s 查看定时任务状态").option("resetUsage", "-u <userId:string> 重置指定用户的使用次数").action(async ({ session, options: options2 }) => {
|
|
3497
3494
|
if (session.user.authority < config.memberDebugCommandAuthLv) {
|
|
3498
3495
|
return `权限不足,需要权限等级 ${config.memberDebugCommandAuthLv} 或以上`;
|
|
3499
3496
|
}
|
|
3500
3497
|
if (!config.membershipEnabled) {
|
|
3501
3498
|
return "会员系统未启用";
|
|
3502
3499
|
}
|
|
3500
|
+
if (options2.resetUsage) {
|
|
3501
|
+
const targetId = options2.resetUsage;
|
|
3502
|
+
if (!userData[targetId]) {
|
|
3503
|
+
return `用户 ${targetId} 不存在`;
|
|
3504
|
+
}
|
|
3505
|
+
userData[targetId].dailyUsage = 0;
|
|
3506
|
+
await membershipSystem.saveUserData();
|
|
3507
|
+
const user = userData[targetId];
|
|
3508
|
+
const dailyLimit = user.isMember ? config.memberDailyLimit : config.nonMemberDailyLimit;
|
|
3509
|
+
const remaining = dailyLimit - user.dailyUsage;
|
|
3510
|
+
return `✅ 已重置用户 ${targetId} 的使用次数
|
|
3511
|
+
当前状态:${user.isMember ? "会员" : "非会员"}
|
|
3512
|
+
每日限额:${dailyLimit} 次
|
|
3513
|
+
已使用:${user.dailyUsage} 次
|
|
3514
|
+
剩余:${remaining} 次`;
|
|
3515
|
+
}
|
|
3503
3516
|
if (options2.status) {
|
|
3504
3517
|
let statusMsg = "【会员系统状态】\n\n";
|
|
3505
3518
|
if (config.memberCleanupEnabled) {
|
|
@@ -3595,7 +3608,7 @@ function apply(ctx, config) {
|
|
|
3595
3608
|
await membershipSystem.checkAndRemindExpiringMembers();
|
|
3596
3609
|
return "✅ 提醒完成!请查看控制台日志获取详细信息。";
|
|
3597
3610
|
}
|
|
3598
|
-
return "请使用以下选项:\n-c 立即执行会员信息清理\n-r 立即执行会员到期提醒\n-s
|
|
3611
|
+
return "请使用以下选项:\n-c 立即执行会员信息清理\n-r 立即执行会员到期提醒\n-s 查看定时任务状态\n-u 重置指定用户的使用次数";
|
|
3599
3612
|
});
|
|
3600
3613
|
}
|
|
3601
3614
|
if (config.directorToolsEnabled !== false) {
|