koishi-plugin-prism-neo 0.0.23 → 0.0.24

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 CHANGED
@@ -528,6 +528,7 @@ async function handleMachineOff(context, alias) {
528
528
  if (!alias) return "请输入设备名";
529
529
  let isAdmin = await context.ctx.permissions.check(context.config.admin, context.session);
530
530
  const res = await machinePowerOff(context, alias, context.session.userId, !isAdmin);
531
+ if (alias === "all") return `全部机器关闭成功`;
531
532
  return `${res.machine} 关闭成功`;
532
533
  }
533
534
  __name(handleMachineOff, "handleMachineOff");
@@ -666,12 +667,12 @@ function apply(ctx, config) {
666
667
  let machines = await getAllMachinePower({ ctx, config });
667
668
  let turnOff = false;
668
669
  machines.forEach((m) => {
669
- if (m.state.state) {
670
+ if (m.state.state === "on") {
670
671
  turnOff = true;
671
672
  }
672
673
  });
673
674
  if (turnOff) {
674
- let res = await machinePowerOff({ ctx, config }, "all", null);
675
+ let res = await machinePowerOff({ ctx, config }, "all", "system", false);
675
676
  ctx.broadcast(config.broadcasts, "窝里目前有 0 人,自动关闭所有机器");
676
677
  }
677
678
  return;
package/lib/service.d.ts CHANGED
@@ -16,13 +16,13 @@ export declare function machinePowerOff({ ctx, config }: ActionContext, machineN
16
16
  export declare function getAllMachinePower({ ctx, config, session }: ActionContext): Promise<{
17
17
  machine: string;
18
18
  state: {
19
- state: boolean;
19
+ state: string;
20
20
  };
21
21
  }[]>;
22
22
  export declare function getMachinePower({ ctx, config, session }: ActionContext, machineName: string): Promise<{
23
23
  machine: string;
24
24
  state: {
25
- state: boolean;
25
+ state: string;
26
26
  };
27
27
  }>;
28
28
  export declare function walletAdd({ ctx, config }: ActionContext, amount: number, userId: string): Promise<any>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-prism-neo",
3
3
  "description": "prism koishi前端",
4
- "version": "0.0.23",
4
+ "version": "0.0.24",
5
5
  "main": "lib/index.js",
6
6
  "files": [
7
7
  "lib",