koishi-plugin-node-async-bot-all 3.1.0 → 3.1.1

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 +14 -13
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -491,7 +491,7 @@ var CommandHandler = class {
491
491
  cpu: vMsg.cpu,
492
492
  memory: vMsg.memory,
493
493
  online: formatTimestampDiff(
494
- Number(botData.uptime),
494
+ Number((await ctx.database.get("botData", "uptime"))[0].data),
495
495
  Number(session.event.timestamp.toString().substring(0, 10))
496
496
  ),
497
497
  msgCount: `${msgCount.receive}/${msgCount.send}`,
@@ -820,7 +820,7 @@ var CommandHandler = class {
820
820
  };
821
821
 
822
822
  // package.json
823
- var version = "3.1.0";
823
+ var version = "3.1.1";
824
824
 
825
825
  // src/config.ts
826
826
  var import_koishi3 = require("koishi");
@@ -915,8 +915,7 @@ var NodeAsyncBot = class {
915
915
  }
916
916
  async init(ct) {
917
917
  this.ctx = ct;
918
- const vUptime = (await this.ctx.database.get("botData", "uptime"))[0];
919
- const date = vUptime ? vUptime.data : (/* @__PURE__ */ new Date()).getTime().toString().substring(0, 10);
918
+ const date = (/* @__PURE__ */ new Date()).getTime().toString().substring(0, 10);
920
919
  this.botData = {
921
920
  version,
922
921
  uptime: date
@@ -1021,15 +1020,17 @@ ${import_koishi4.h.image(outMsg.data, "image/png")}`
1021
1020
  const match = session.content.match(/^#([a-zA-Z0-9]+)cat$/);
1022
1021
  if (match) {
1023
1022
  const system = await getSystemUsage();
1024
- await session.send(session.text("cat", {
1025
- name: match[1].charAt(0).toUpperCase() + match[1].slice(1),
1026
- time: formatTimestampDiff(
1027
- Number(this.botData.uptime),
1028
- Number(session.event.timestamp.toString().substring(0, 10))
1029
- ),
1030
- version: this.botData.version,
1031
- platform: system.success == 1 ? "未知" : system.name
1032
- }));
1023
+ await session.send(
1024
+ session.text("cat", {
1025
+ name: match[1].charAt(0).toUpperCase() + match[1].slice(1),
1026
+ time: formatTimestampDiff(
1027
+ Number((await this.ctx.database.get("botData", "uptime"))[0].data),
1028
+ Number(session.event.timestamp.toString().substring(0, 10))
1029
+ ),
1030
+ version: this.botData.version,
1031
+ platform: system.success == 1 ? "未知" : system.name
1032
+ })
1033
+ );
1033
1034
  }
1034
1035
  if (session.bot.createReaction) {
1035
1036
  for (const content of this.ctx.config.specialMsg) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koishi-plugin-node-async-bot-all",
3
- "version": "3.1.0",
3
+ "version": "3.1.1",
4
4
  "description": "NodeAsync Bot插件(自用)",
5
5
  "keywords": [
6
6
  "chatbot",