koishi-plugin-prism-neo 0.0.24 → 0.0.25
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.d.ts +1 -0
- package/lib/index.js +8 -2
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -187,6 +187,9 @@ var Config = import_koishi.Schema.object({
|
|
|
187
187
|
broadcasts: import_koishi.Schema.array(
|
|
188
188
|
import_koishi.Schema.string()
|
|
189
189
|
),
|
|
190
|
+
pmOnLogout: import_koishi.Schema.array(
|
|
191
|
+
import_koishi.Schema.string()
|
|
192
|
+
),
|
|
190
193
|
currency: import_koishi.Schema.string().default("月饼").description("货币名称"),
|
|
191
194
|
autoLockOnLogin: import_koishi.Schema.boolean().default(true).description("登录时自动获取门锁密码"),
|
|
192
195
|
logoutConfirmation: import_koishi.Schema.boolean().default(true).description("登出时需要二次确认"),
|
|
@@ -370,9 +373,12 @@ async function handleLogoutCmd(context, user) {
|
|
|
370
373
|
if (error) return error;
|
|
371
374
|
if (!context.config.logoutConfirmation) {
|
|
372
375
|
const res = await logout(context, targetUserId);
|
|
373
|
-
let
|
|
376
|
+
let name2 = await getUserName(context.session, targetUserId);
|
|
377
|
+
let message = user ? `✅ 已为用户 ${name2} 退场` : "✅ 退场成功";
|
|
374
378
|
message += "\n";
|
|
375
379
|
message += formatBilling(res, context.config.currency);
|
|
380
|
+
await context.session.bot.broadcast(context.config.pmOnLogout, `${name2}
|
|
381
|
+
${message}`);
|
|
376
382
|
return message;
|
|
377
383
|
}
|
|
378
384
|
const pendingLogout = kv.get(targetUserId);
|
|
@@ -667,7 +673,7 @@ function apply(ctx, config) {
|
|
|
667
673
|
let machines = await getAllMachinePower({ ctx, config });
|
|
668
674
|
let turnOff = false;
|
|
669
675
|
machines.forEach((m) => {
|
|
670
|
-
if (m.state.state
|
|
676
|
+
if (m.state.state !== "off") {
|
|
671
677
|
turnOff = true;
|
|
672
678
|
}
|
|
673
679
|
});
|