mioki 0.9.1 → 0.9.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/dist/index.d.cts CHANGED
@@ -385,6 +385,7 @@ interface MiokiConfig {
385
385
  online_push?: boolean;
386
386
  log_level?: LogLevel;
387
387
  plugins_dir?: string;
388
+ status_permission?: "all" | "admin-only";
388
389
  napcat: {
389
390
  protocol?: "ws" | "wss";
390
391
  port?: number;
@@ -582,7 +583,9 @@ interface MiokiStatus {
582
583
  //#region src/builtins/core/index.d.ts
583
584
  interface MiokiCoreServiceContrib {
584
585
  /** 获取框架和系统的实时状态 */
585
- getMiokiStatus(): Promise<MiokiStatus>;
586
+ miokiStatus(): Promise<MiokiStatus>;
587
+ /** 获取框架和系统的实时状态字符串 */
588
+ miokiStatusStr(): Promise<string>;
586
589
  }
587
590
  declare namespace services_d_exports {
588
591
  export { MiokiServices, addService, services };
package/dist/index.d.mts CHANGED
@@ -383,6 +383,7 @@ interface MiokiConfig {
383
383
  online_push?: boolean;
384
384
  log_level?: LogLevel;
385
385
  plugins_dir?: string;
386
+ status_permission?: "all" | "admin-only";
386
387
  napcat: {
387
388
  protocol?: "ws" | "wss";
388
389
  port?: number;
@@ -580,7 +581,9 @@ interface MiokiStatus {
580
581
  //#region src/builtins/core/index.d.ts
581
582
  interface MiokiCoreServiceContrib {
582
583
  /** 获取框架和系统的实时状态 */
583
- getMiokiStatus(): Promise<MiokiStatus>;
584
+ miokiStatus(): Promise<MiokiStatus>;
585
+ /** 获取框架和系统的实时状态字符串 */
586
+ miokiStatusStr(): Promise<string>;
584
587
  }
585
588
  declare namespace services_d_exports {
586
589
  export { MiokiServices, addService, services };
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { t as __export } from "./chunk-DYZpOiH0.mjs";
2
- import { t as version } from "./package-CbQDT4KP.mjs";
2
+ import { t as version } from "./package-BUreTxqg.mjs";
3
3
  import fs, { default as fs$1 } from "node:fs";
4
4
  import util from "node:util";
5
5
  import path, { default as path$1 } from "node:path";
@@ -1483,10 +1483,13 @@ const core = definePlugin({
1483
1483
  const prefix = (ctx.botConfig.prefix ?? "#").replace(/[-_.^$?[\]{}]/g, "\\$&");
1484
1484
  const cmdPrefix = /* @__PURE__ */ new RegExp(`^${prefix}`);
1485
1485
  const displayPrefix = prefix.replace(/\\\\/g, "\\");
1486
+ const statusAdminOnly = ctx.botConfig.status_permission === "admin-only";
1486
1487
  ctx.addService("miokiStatus", () => getMiokiStatus(ctx.bot));
1488
+ ctx.addService("miokiStatusStr", () => getMiokiStatusStr(ctx.bot));
1487
1489
  ctx.handle("message", (e) => ctx.runWithErrorHandler(async () => {
1488
1490
  const text$1 = ctx.text(e);
1489
1491
  if (!cmdPrefix.test(text$1)) return;
1492
+ if (statusAdminOnly && !ctx.hasRight(e)) return;
1490
1493
  if (text$1.replace(cmdPrefix, "") === "状态") {
1491
1494
  const status = await getMiokiStatusStr(ctx.bot);
1492
1495
  await e.reply(`〓 🟢 mioki 状态 〓\n${status}`.trim());