mioki 0.15.1 → 0.16.0

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
@@ -690,12 +690,21 @@ declare const deduplicator: Deduplicator;
690
690
  * Mioki 上下文对象,包含 Mioki 运行时的信息和方法
691
691
  */
692
692
  interface MiokiContext extends Services, Configs, Utils, RemoveBotParam<Actions> {
693
- /** 当前处理事件的机器人实例 */
693
+ /**
694
+ * 单实例模式下:机器人实例
695
+ * 多实例模式下:第一个机器人实例
696
+ *
697
+ * 如果要获取指定机器人实例,请使用 ctx.getBot(id) 方法,id 通常可以从 event.self_id 获取
698
+ */
694
699
  bot: NapCat;
695
- /** 所有已连接的机器人实例列表 */
696
- bots: ExtendedNapCat[];
697
700
  /** 当前机器人 QQ 号 */
698
701
  self_id: number;
702
+ /** 多实例模式下:所有已连接的机器人实例列表 */
703
+ bots: ExtendedNapCat[];
704
+ /** 多实例模式下:通过 QQ 号获取机器人实例 */
705
+ pickBot: (id: number) => ExtendedNapCat;
706
+ /** 多实例模式下:需要手动传入 bot 实例的操作方法集合*/
707
+ actions: Actions;
699
708
  /** 消息构造器 */
700
709
  segment: NapCat['segment'];
701
710
  /** 通过域名获取 Cookies */
package/dist/index.d.mts CHANGED
@@ -688,12 +688,21 @@ declare const deduplicator: Deduplicator;
688
688
  * Mioki 上下文对象,包含 Mioki 运行时的信息和方法
689
689
  */
690
690
  interface MiokiContext extends Services, Configs, Utils, RemoveBotParam<Actions> {
691
- /** 当前处理事件的机器人实例 */
691
+ /**
692
+ * 单实例模式下:机器人实例
693
+ * 多实例模式下:第一个机器人实例
694
+ *
695
+ * 如果要获取指定机器人实例,请使用 ctx.getBot(id) 方法,id 通常可以从 event.self_id 获取
696
+ */
692
697
  bot: NapCat;
693
- /** 所有已连接的机器人实例列表 */
694
- bots: ExtendedNapCat[];
695
698
  /** 当前机器人 QQ 号 */
696
699
  self_id: number;
700
+ /** 多实例模式下:所有已连接的机器人实例列表 */
701
+ bots: ExtendedNapCat[];
702
+ /** 多实例模式下:通过 QQ 号获取机器人实例 */
703
+ pickBot: (id: number) => ExtendedNapCat;
704
+ /** 多实例模式下:需要手动传入 bot 实例的操作方法集合*/
705
+ actions: Actions;
697
706
  /** 消息构造器 */
698
707
  segment: NapCat['segment'];
699
708
  /** 通过域名获取 Cookies */
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./chunk-BiucMVzj.mjs";
2
- import { t as version } from "./package-75_Caljc.mjs";
2
+ import { t as version } from "./package-UYRX612w.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";
@@ -1380,13 +1380,15 @@ async function enablePlugin(bots, plugin, type = "external") {
1380
1380
  const createContext = (bot) => {
1381
1381
  return {
1382
1382
  bot,
1383
- bots,
1384
1383
  self_id: bot.bot_id,
1384
+ bots,
1385
+ pickBot: (id) => bots.find((b) => b.bot_id === id),
1385
1386
  segment: bot.segment,
1386
1387
  getCookie: bot.getCookie.bind(bot),
1387
1388
  ...utils_exports,
1388
1389
  ...config_exports,
1389
1390
  ...buildRemovedActions(bot),
1391
+ actions: actions_exports,
1390
1392
  logger: logger$1,
1391
1393
  services,
1392
1394
  clears: userClears,