koishi-plugin-node-async-bot-all 2.24.12 → 2.26.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/lib/commands.d.ts CHANGED
@@ -79,4 +79,5 @@ export declare function getNewsMsg(ctx: Context, type: number): Promise<{
79
79
  data?: Buffer;
80
80
  msg: string;
81
81
  }>;
82
+ export declare function getUse(ctx: Context, session: Session, qq: string, desc: string): Promise<number>;
82
83
  export {};
package/lib/index.js CHANGED
@@ -34,7 +34,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
34
34
  // src/locales/zh-CN.yml
35
35
  var require_zh_CN = __commonJS({
36
36
  "src/locales/zh-CN.yml"(exports2, module2) {
37
- module2.exports = { noApi: "未指定 API", noop: "无", unknownError: "未知错误。", commands: { cxgame: { description: "查询服务器当前人数。", messages: { msg: "{time}{list}\n进服指南请在群公告中查看。", list: "【MC 服务器 {count}】\n➣ {version}:{players}\n➣ 玩家列表:{list}\n➣ 备注:{note}", listNoPlayer: "【MC 服务器 {count}】\n➣ {version}:{players}\n➣ 备注:{note}", listFailed: "【MC 服务器 {count}】\n➣ 查询失败:{data}\n➣ 请稍后重试。\n➣ 备注:{note}", listA2S: "【A2S 服务器 {count}】\n➣ {version}:{players}\n➣ 机器人:{bots}\n➣ 备注:{note}", listFailedA2S: "【A2S 服务器 {count}】\n➣ 查询失败:{data}\n➣ 请稍后重试。\n➣ 备注:{note}", forbidden: "{time}\n此指令不允许在本群使用。", failed: "{time}\n查询失败:{data}", timeout: "请求超时。", fewData: "服务端返回的数据过少。", close: "服务器已关闭。", host: "没有到主机的路由。", dns: "解析失败。" } }, status: { description: "查询机器人状态。", messages: { msg: "{time}\n--- 系统状态 ---\n系统名称:{name}\nCPU使用率:{cpu}\n内存使用率:{memory}\n--- 机器人状态 ---\n昨日收/发消息数量:{msgCount}\n机器人版本:{version}\n运行时间:{online}", failed: "{time}\n状态获取失败。" } }, random: { description: "随机数生成器。", usage: "缺少参数时默认生成 0-10000 的随机数。\n使用示例:", examples: "random 1 128 生成1到128范围的随机数", messages: { msg: "{time}\n生成的随机数:{data}" } }, info: { description: "查询机器人信息。", messages: { msg: "{data}", failed: "{time}\n读取信息失败。" } }, rw: { description: "随机名言名句。", messages: { msg: "{time}\n{data}", failed: "{time}\n获取失败({data})。" } }, randomba: { description: "随机BA图。", messages: { msg: "{quote}{image}", wait: "{quote}{time}\n请等待图片上传(可能较慢)。" } }, centerservertest: { description: "查看中心服务器状态。", messages: { msg: "{time}{list}", list: "== {name} ==\n状态:{status}\n存活率:{uptime}\n检测时间:{time}", listFailed: "== {name} ==\n查看失败:{data}", failed: "{time}\n查看失败:{data}", statusLive: "✅ 正常", statusDie: "❌ 故障", dataFail: "未能获取到此服务器的状态信息。" } }, meme: { description: "群友的怪话!", messages: { msg: "{quote}{time}\n{image}\n{title}", failed: "{quote}{time}\n获取失败:{data}", forbidden: "{quote}{time}\n此指令不允许在本群使用。" } }, randomcat: { description: "随机猫猫图。", messages: { msg: "{quote}{image}", wait: "{quote}{time}\n请等待图片上传(可能较慢)。", failed: "{quote}{time}\n获取失败:{data}" } }, getqqinfo: { description: "获取 QQ 号的信息。", messages: { msg: "{quote}{image}", failed: "{quote}{time}\n获取失败:{data}", command: "QQ 号不正确。" } }, msg2img: { description: "引用一个消息并使用此指令,即可将消息转图。", messages: { msg: "{quote}{image}", failed: "{quote}{time}\n获取失败:{data}", null: "未引用任何消息。", matroska: "{quote}禁止套娃!" } }, slnews: { description: "抓取 NorthWood 的 Steam 最新新闻。" } } };
37
+ module2.exports = { noApi: "未指定 API", noop: "无", unknownError: "未知错误。", commands: { na: { description: "NodeAsync Bot" }, cxgame: { description: "查询服务器当前人数。", messages: { msg: "{time}{list}\n进服指南请在群公告中查看。", list: "【MC 服务器 {count}】\n➣ {version}:{players}\n➣ 玩家列表:{list}\n➣ 备注:{note}", listNoPlayer: "【MC 服务器 {count}】\n➣ {version}:{players}\n➣ 备注:{note}", listFailed: "【MC 服务器 {count}】\n➣ 查询失败:{data}\n➣ 请稍后重试。\n➣ 备注:{note}", listA2S: "【A2S 服务器 {count}】\n➣ {version}:{players}\n➣ 机器人:{bots}\n➣ 备注:{note}", listFailedA2S: "【A2S 服务器 {count}】\n➣ 查询失败:{data}\n➣ 请稍后重试。\n➣ 备注:{note}", forbidden: "{time}\n此指令不允许在本群使用。", failed: "{time}\n查询失败:{data}", timeout: "请求超时。", fewData: "服务端返回的数据过少。", close: "服务器已关闭。", host: "没有到主机的路由。", dns: "解析失败。" } }, status: { description: "查询机器人状态。", messages: { msg: "{time}\n--- 系统状态 ---\n系统名称:{name}\nCPU使用率:{cpu}\n内存使用率:{memory}\n--- 机器人状态 ---\n昨日收/发消息数量:{msgCount}\n机器人版本:{version}\n运行时间:{online}", failed: "{time}\n状态获取失败。" } }, random: { description: "随机数生成器。", usage: "缺少参数时默认生成 0-10000 的随机数。\n使用示例:", examples: "random 1 128 生成1到128范围的随机数", messages: { msg: "{time}\n生成的随机数:{data}" } }, info: { description: "查询机器人信息。", messages: { msg: "{data}", failed: "{time}\n读取信息失败。" } }, rw: { description: "随机名言名句。", messages: { msg: "{time}\n{data}", failed: "{time}\n获取失败({data})。" } }, randomba: { description: "随机BA图。", messages: { msg: "{quote}{image}", wait: "{quote}{time}\n请等待图片上传(可能较慢)。" } }, centerservertest: { description: "查看中心服务器状态。", messages: { msg: "{time}{list}", list: "== {name} ==\n状态:{status}\n存活率:{uptime}\n检测时间:{time}", listFailed: "== {name} ==\n查看失败:{data}", failed: "{time}\n查看失败:{data}", statusLive: "✅ 正常", statusDie: "❌ 故障", dataFail: "未能获取到此服务器的状态信息。" } }, meme: { description: "群友的怪话!", usage: "不带参数时随机查看\n带参数时为查看指定 meme", examples: "meme\nmeme 1145", messages: { msg: "{quote}{time}\n{image}\n{title}", failed: "{quote}{time}\n获取失败:{data}", forbidden: "{quote}{time}\n此指令不允许在本群使用。" } }, randomcat: { description: "随机猫猫图。", messages: { msg: "{quote}{image}", wait: "{quote}{time}\n请等待图片上传(可能较慢)。", failed: "{quote}{time}\n获取失败:{data}" } }, getqqinfo: { description: "获取 QQ 号的信息。", usage: "获取 QQ 号的信息。", examples: "getqqinfo 10001", messages: { msg: "{quote}{image}", failed: "{quote}{time}\n获取失败:{data}", command: "QQ 号不正确。" } }, msg2img: { description: "引用一个消息并使用此指令,即可将消息转图。", usage: "引用一条消息,/m。(不要带@)", messages: { msg: "{quote}{image}", failed: "{quote}{time}\n获取失败:{data}", null: "未引用任何消息。", matroska: "{quote}禁止套娃!" } }, slnews: { description: "抓取 NorthWood 的 Steam 最新新闻。" }, use: { description: "使用 TA !", usage: "use @用户", examples: "use @用户", messages: { command: "请 @ 一个用户。", msg: "{at} {desc}了 {at2} !" } } } };
38
38
  }
39
39
  });
40
40
 
@@ -928,9 +928,16 @@ async function getNewsMsg(ctx, type) {
928
928
  }
929
929
  }
930
930
  __name(getNewsMsg, "getNewsMsg");
931
+ async function getUse(ctx, session, qq, desc) {
932
+ const log = ctx.logger("getUse");
933
+ log.debug(`Got: {"form":"${session.platform}:${session.event.guild?.id}","user":"${session.event.user?.id}","timestamp":${session.event.timestamp},"messageId":"${session.event.message?.id}"}`);
934
+ await session.send(session.text(".msg", { "at": import_koishi2.h.at(session.event.user?.id), "at2": import_koishi2.h.at(qq), "desc": desc ?? "使用" }));
935
+ return 0;
936
+ }
937
+ __name(getUse, "getUse");
931
938
 
932
939
  // package.json
933
- var version = "2.24.12";
940
+ var version = "2.26.0";
934
941
 
935
942
  // src/index.ts
936
943
  var inject = ["database", "installer", "puppeteer", "cron"];
@@ -997,7 +1004,8 @@ function apply(ctx) {
997
1004
  { id: "version", data: version }
998
1005
  ]);
999
1006
  });
1000
- ctx.command("slnews").action(async () => {
1007
+ const na = ctx.command("na");
1008
+ na.subcommand("slnews").action(async () => {
1001
1009
  const log = ctx.logger("slnews");
1002
1010
  const outMsg = await getNewsMsg(ctx, 1);
1003
1011
  if (outMsg.data) {
@@ -1024,7 +1032,7 @@ ${import_koishi3.h.image(outMsg.data, "image/png")}`);
1024
1032
  await ctx.broadcast(ctx.config.slNews, outMsg.msg);
1025
1033
  }
1026
1034
  });
1027
- ctx.command("cxGame").action(async ({ session }) => {
1035
+ na.subcommand("cxGame").action(async ({ session }) => {
1028
1036
  const cx = await getServer(ctx, session);
1029
1037
  if (cx["success"] == 0) {
1030
1038
  return session?.text(".msg", cx);
@@ -1034,7 +1042,7 @@ ${import_koishi3.h.image(outMsg.data, "image/png")}`);
1034
1042
  return session?.text(".failed", cx);
1035
1043
  }
1036
1044
  });
1037
- ctx.command("status").alias("stats").alias("状态").action(async ({ session }) => {
1045
+ na.subcommand("status").alias("stats").alias("状态").action(async ({ session }) => {
1038
1046
  const status2 = await getStatus(ctx, session);
1039
1047
  if (status2["success"] == 0) {
1040
1048
  return session?.text(".msg", status2);
@@ -1042,11 +1050,11 @@ ${import_koishi3.h.image(outMsg.data, "image/png")}`);
1042
1050
  return session?.text(".failed", status2);
1043
1051
  }
1044
1052
  });
1045
- ctx.command("random [最小数:number] [最大数:number]").alias("随机数").action(async ({ session }, min, max) => {
1053
+ na.subcommand("random [最小数:number] [最大数:number]").alias("随机数").action(async ({ session }, min, max) => {
1046
1054
  const random2 = await getRandom(ctx, session, min, max);
1047
1055
  return session?.text(".msg", random2);
1048
1056
  });
1049
- ctx.command("info").action(async ({ session }) => {
1057
+ na.subcommand("info").action(async ({ session }) => {
1050
1058
  const info = await getInfo(ctx, session);
1051
1059
  if (info["success"] == 0) {
1052
1060
  return session?.text(".msg", info);
@@ -1054,7 +1062,7 @@ ${import_koishi3.h.image(outMsg.data, "image/png")}`);
1054
1062
  return session?.text(".failed", info);
1055
1063
  }
1056
1064
  });
1057
- ctx.command("rw").action(async ({ session }) => {
1065
+ na.subcommand("rw").action(async ({ session }) => {
1058
1066
  const rw = await getRandomWord(ctx, session);
1059
1067
  if (rw["success"] == 0) {
1060
1068
  return session?.text(".msg", rw);
@@ -1062,26 +1070,31 @@ ${import_koishi3.h.image(outMsg.data, "image/png")}`);
1062
1070
  return session?.text(".failed", rw);
1063
1071
  }
1064
1072
  });
1065
- ctx.command("randomBA").alias("随机ba图").action(async ({ session }) => {
1073
+ na.subcommand("randomBA").alias("随机ba图").action(async ({ session }) => {
1066
1074
  await getBlueArchive(ctx, session);
1067
1075
  });
1068
- ctx.command("centerServerTest").alias("测测中心服务器").action(async ({ session }) => {
1076
+ na.subcommand("centerServerTest").alias("测测中心服务器").action(async ({ session }) => {
1069
1077
  const msg = await centerServerTest(ctx, session);
1070
1078
  return session?.text(msg.success, msg.data);
1071
1079
  });
1072
- ctx.command("meme [序号:posint]").alias("memes").action(async ({ session }, count) => {
1080
+ na.subcommand("meme [序号:posint]").alias("memes").action(async ({ session }, count) => {
1073
1081
  await getMeme(ctx, session, count);
1074
1082
  });
1075
- ctx.command("randomCat").alias("随机猫猫图").alias("随机猫猫").action(async ({ session }) => {
1083
+ na.subcommand("randomCat").alias("随机猫猫图").alias("随机猫猫").action(async ({ session }) => {
1076
1084
  await getCat(ctx, session);
1077
1085
  });
1078
- ctx.command("getQQInfo <QQ号:string>").alias("获取QQ信息").action(async ({ session }, qq) => {
1086
+ na.subcommand("getQQInfo <QQ号:string>").alias("获取QQ信息").action(async ({ session }, qq) => {
1079
1087
  if (qq == void 0 || isNaN(Number(qq))) return session?.text(".command");
1080
1088
  await getQQInfo(ctx, session, qq);
1081
1089
  });
1082
- ctx.command("msg2img").option("inversion", "-i").alias("消息转图").alias("m").action(async ({ session, options }) => {
1090
+ na.subcommand("msg2img").option("inversion", "-i").alias("消息转图").alias("m").action(async ({ session, options }) => {
1083
1091
  await getMsg(ctx, session, options?.inversion);
1084
1092
  });
1093
+ na.subcommand("use <user:user> [方法:string]").alias("u").action(async ({ session }, user, desc) => {
1094
+ const qq = user?.split(":")?.[1];
1095
+ if (qq == void 0 || isNaN(Number(qq))) return session?.text(".command");
1096
+ await getUse(ctx, session, qq, desc);
1097
+ });
1085
1098
  }
1086
1099
  __name(apply, "apply");
1087
1100
  // Annotate the CommonJS export names for ESM import in node:
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-node-async-bot-all",
3
3
  "description": "NodeAsync Bot插件(自用)",
4
- "version": "2.24.12",
4
+ "version": "2.26.0",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "contributors": [