koishi-plugin-node-async-bot-all 2.27.0 → 2.28.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.
Files changed (2) hide show
  1. package/lib/index.js +36 -7
  2. package/package.json +1 -1
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: { 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} !" } } } };
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}" } }, 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}", 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
 
@@ -613,14 +613,12 @@ async function getBlueArchive(ctx, session) {
613
613
  await session.send(session.text(".msg", { "quote": import_koishi2.h.quote(session.messageId), "image": session.text("noApi") }));
614
614
  return 1;
615
615
  }
616
- const vid = await session.send(session.text(".wait", { "quote": import_koishi2.h.quote(session.messageId), "time": time }));
617
616
  const ms = random(0, 0, 1500);
618
617
  const link = random(2, ctx.config.baAPI) + `?cacheBuster=${random(1, 1, 2147483647)}`;
619
618
  log.debug(`Link: ${link}`);
620
619
  await (0, import_koishi2.sleep)(ms);
621
620
  const status2 = await session.send(session.text(".msg", { "quote": import_koishi2.h.quote(session.messageId), "image": import_koishi2.h.image(link) }));
622
621
  if (!status2) await session.send(session.text(".msg", { "quote": import_koishi2.h.quote(session.messageId), "image": import_koishi2.h.image(link) }));
623
- await session.bot.deleteMessage(session.event.guild?.id, vid[0]);
624
622
  return 0;
625
623
  }
626
624
  __name(getBlueArchive, "getBlueArchive");
@@ -743,7 +741,6 @@ async function getCat(ctx, session) {
743
741
  log.warn("未指定 API");
744
742
  return 1;
745
743
  }
746
- const vid = await session.send(session.text(".wait", { "quote": import_koishi2.h.quote(session.messageId), "time": time }));
747
744
  const response = await request(ctx.config.catAPI, {}, ctx.config.timeout, log);
748
745
  if (response.success) {
749
746
  log.debug(response.data);
@@ -762,7 +759,6 @@ async function getCat(ctx, session) {
762
759
  log.warn(response.error);
763
760
  }
764
761
  }
765
- await session.bot.deleteMessage(session.event.guild?.id, vid[0]);
766
762
  return 0;
767
763
  }
768
764
  __name(getCat, "getCat");
@@ -943,7 +939,7 @@ async function getUse(ctx, session, qq, desc) {
943
939
  __name(getUse, "getUse");
944
940
 
945
941
  // package.json
946
- var version = "2.27.0";
942
+ var version = "2.28.0";
947
943
 
948
944
  // src/index.ts
949
945
  var inject = ["database", "installer", "puppeteer", "cron"];
@@ -1001,6 +997,15 @@ var Config = import_koishi3.Schema.intersect([
1001
997
  })).default([{ "id": "1", "name": "中心 鲁贝 1" }, { "id": "19", "name": "中心 斯特拉斯堡 1" }, { "id": "3", "name": "Steam 认证 API" }]).description("测试中心服务器")
1002
998
  }).description("测试中心服务器")
1003
999
  ]).description("基础设置");
1000
+ async function startReaction(session) {
1001
+ await session.bot.createReaction(session.channelId, session.messageId, `face|424`);
1002
+ }
1003
+ __name(startReaction, "startReaction");
1004
+ async function endReaction(session) {
1005
+ await session.bot.deleteReaction(session.channelId, session.messageId, `face|424`);
1006
+ await session.bot.createReaction(session.channelId, session.messageId, `face|144`);
1007
+ }
1008
+ __name(endReaction, "endReaction");
1004
1009
  function apply(ctx) {
1005
1010
  ctx.i18n.define("zh-CN", require_zh_CN());
1006
1011
  ctx.on("ready", async () => {
@@ -1046,12 +1051,14 @@ ${import_koishi3.h.image(outMsg.data, "image/png")}`);
1046
1051
  ctx.on("message", async (session) => {
1047
1052
  for (const content of ctx.config.specialMsg) {
1048
1053
  if (session.content === content) {
1049
- await session.bot.createReaction(session.channelId, session.messageId, String(random(2, ctx.config.reactionId)));
1054
+ await session.bot.createReaction(session.channelId, session.messageId, `face|${String(random(2, ctx.config.reactionId))}`);
1050
1055
  }
1051
1056
  }
1052
1057
  });
1053
1058
  na.subcommand("cxGame").action(async ({ session }) => {
1059
+ await startReaction(session);
1054
1060
  const cx = await getServer(ctx, session);
1061
+ await endReaction(session);
1055
1062
  if (cx["success"] == 0) {
1056
1063
  return session?.text(".msg", cx);
1057
1064
  } else if (cx["success"] == 1) {
@@ -1061,7 +1068,9 @@ ${import_koishi3.h.image(outMsg.data, "image/png")}`);
1061
1068
  }
1062
1069
  });
1063
1070
  na.subcommand("status").alias("stats").alias("状态").action(async ({ session }) => {
1071
+ await startReaction(session);
1064
1072
  const status2 = await getStatus(ctx, session);
1073
+ await endReaction(session);
1065
1074
  if (status2["success"] == 0) {
1066
1075
  return session?.text(".msg", status2);
1067
1076
  } else {
@@ -1069,11 +1078,15 @@ ${import_koishi3.h.image(outMsg.data, "image/png")}`);
1069
1078
  }
1070
1079
  });
1071
1080
  na.subcommand("random [最小数:number] [最大数:number]").alias("随机数").action(async ({ session }, min, max) => {
1081
+ await startReaction(session);
1072
1082
  const random2 = await getRandom(ctx, session, min, max);
1083
+ await endReaction(session);
1073
1084
  return session?.text(".msg", random2);
1074
1085
  });
1075
1086
  na.subcommand("info").action(async ({ session }) => {
1087
+ await startReaction(session);
1076
1088
  const info = await getInfo(ctx, session);
1089
+ await endReaction(session);
1077
1090
  if (info["success"] == 0) {
1078
1091
  return session?.text(".msg", info);
1079
1092
  } else {
@@ -1081,7 +1094,9 @@ ${import_koishi3.h.image(outMsg.data, "image/png")}`);
1081
1094
  }
1082
1095
  });
1083
1096
  na.subcommand("rw").action(async ({ session }) => {
1097
+ await startReaction(session);
1084
1098
  const rw = await getRandomWord(ctx, session);
1099
+ await endReaction(session);
1085
1100
  if (rw["success"] == 0) {
1086
1101
  return session?.text(".msg", rw);
1087
1102
  } else {
@@ -1089,29 +1104,43 @@ ${import_koishi3.h.image(outMsg.data, "image/png")}`);
1089
1104
  }
1090
1105
  });
1091
1106
  na.subcommand("randomBA").alias("随机ba图").action(async ({ session }) => {
1107
+ await startReaction(session);
1092
1108
  await getBlueArchive(ctx, session);
1109
+ await endReaction(session);
1093
1110
  });
1094
1111
  na.subcommand("centerServerTest").alias("测测中心服务器").action(async ({ session }) => {
1112
+ await startReaction(session);
1095
1113
  const msg = await centerServerTest(ctx, session);
1114
+ await endReaction(session);
1096
1115
  return session?.text(msg.success, msg.data);
1097
1116
  });
1098
1117
  na.subcommand("meme [序号:posint]").alias("memes").action(async ({ session }, count) => {
1118
+ await startReaction(session);
1099
1119
  await getMeme(ctx, session, count);
1120
+ await endReaction(session);
1100
1121
  });
1101
1122
  na.subcommand("randomCat").alias("随机猫猫图").alias("随机猫猫").action(async ({ session }) => {
1123
+ await startReaction(session);
1102
1124
  await getCat(ctx, session);
1125
+ await endReaction(session);
1103
1126
  });
1104
1127
  na.subcommand("getQQInfo <QQ号:string>").alias("获取QQ信息").action(async ({ session }, qq) => {
1105
1128
  if (qq == void 0 || isNaN(Number(qq))) return session?.text(".command");
1129
+ await startReaction(session);
1106
1130
  await getQQInfo(ctx, session, qq);
1131
+ await endReaction(session);
1107
1132
  });
1108
1133
  na.subcommand("msg2img").option("inversion", "-i").alias("消息转图").alias("m").action(async ({ session, options }) => {
1134
+ await startReaction(session);
1109
1135
  await getMsg(ctx, session, options?.inversion);
1136
+ await endReaction(session);
1110
1137
  });
1111
1138
  na.subcommand("use <user:user> [方法:string]").alias("u").action(async ({ session }, user, desc) => {
1112
1139
  const qq = user?.split(":")?.[1];
1113
1140
  if (qq == void 0 || isNaN(Number(qq))) return session?.text(".command");
1141
+ await startReaction(session);
1114
1142
  await getUse(ctx, session, qq, desc);
1143
+ await endReaction(session);
1115
1144
  });
1116
1145
  }
1117
1146
  __name(apply, "apply");
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.27.0",
4
+ "version": "2.28.0",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "contributors": [