koishi-plugin-bilibili-notify 3.3.15 → 3.4.0-alpha.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.
package/lib/index.cjs CHANGED
@@ -32,8 +32,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
32
32
  let koishi = require("koishi");
33
33
  require("@koishijs/plugin-notifier");
34
34
  require("@koishijs/plugin-help");
35
- let node_url = require("node:url");
36
- let node_path = require("node:path");
37
35
  let blive_message_listener = require("blive-message-listener");
38
36
  let qrcode = require("qrcode");
39
37
  qrcode = __toESM(qrcode);
@@ -42,6 +40,8 @@ let luxon = require("luxon");
42
40
  let __node_rs_jieba = require("@node-rs/jieba");
43
41
  let __node_rs_jieba_dict = require("@node-rs/jieba/dict");
44
42
  require("koishi-plugin-puppeteer");
43
+ let node_path = require("node:path");
44
+ let node_url = require("node:url");
45
45
  let md5 = require("md5");
46
46
  md5 = __toESM(md5);
47
47
  let node_crypto = require("node:crypto");
@@ -188,7 +188,7 @@ async function withRetry(fn, maxAttempts = 3, delayMs = 1e3) {
188
188
  } catch (error) {
189
189
  attempt++;
190
190
  if (attempt >= maxAttempts) throw error;
191
- await new Promise((resolve$2) => setTimeout(resolve$2, delayMs * attempt));
191
+ await new Promise((resolve$1) => setTimeout(resolve$1, delayMs * attempt));
192
192
  }
193
193
  }
194
194
  function replaceButKeep(oldObj, newObj, keepKeys) {
@@ -1311,9 +1311,9 @@ var ComRegister = class {
1311
1311
  const liveData = { likedNum: "0" };
1312
1312
  const liveMsgObj = this.liveMsgManager.get(sub.uid);
1313
1313
  const guardLevelImg = {
1314
- [blive_message_listener.GuardLevel.Jianzhang]: (0, node_url.pathToFileURL)((0, node_path.resolve)(__dirname, "img/captain.png")),
1315
- [blive_message_listener.GuardLevel.Tidu]: (0, node_url.pathToFileURL)((0, node_path.resolve)(__dirname, "img/supervisor.png")),
1316
- [blive_message_listener.GuardLevel.Zongdu]: (0, node_url.pathToFileURL)((0, node_path.resolve)(__dirname, "img/governor.png"))
1314
+ [blive_message_listener.GuardLevel.Jianzhang]: "https://s1.hdslb.com/bfs/static/blive/live-pay-mono/relation/relation/assets/captain-Bjw5Byb5.png",
1315
+ [blive_message_listener.GuardLevel.Tidu]: "https://s1.hdslb.com/bfs/static/blive/live-pay-mono/relation/relation/assets/supervisor-u43ElIjU.png",
1316
+ [blive_message_listener.GuardLevel.Zongdu]: "https://s1.hdslb.com/bfs/static/blive/live-pay-mono/relation/relation/assets/governor-DpDXKEdA.png"
1317
1317
  };
1318
1318
  const sendDanmakuWordCloudAndLiveSummary = async (customLiveSummary) => {
1319
1319
  this.logger.info("开始制作弹幕词云");
@@ -1453,7 +1453,7 @@ var ComRegister = class {
1453
1453
  },
1454
1454
  onGuardBuy: ({ body }) => {
1455
1455
  const guardImg = guardLevelImg[body.guard_level];
1456
- const content = (0, koishi.h)("message", [koishi.h.text(`【${masterInfo.username}的直播间】${body.user.uname}加入了大航海(${body.gift_name})`), koishi.h.image(guardImg.href)]);
1456
+ const content = (0, koishi.h)("message", [koishi.h.text(`【${masterInfo.username}的直播间】${body.user.uname}加入了大航海(${body.gift_name})`), koishi.h.image(guardImg)]);
1457
1457
  this.broadcastToTargets(sub.uid, content, PushType.LiveGuardBuy);
1458
1458
  },
1459
1459
  onLiveStart: async () => {
@@ -1693,10 +1693,10 @@ var ComRegister = class {
1693
1693
  this.subNotifier = this.ctx.notifier.create(table);
1694
1694
  }
1695
1695
  async checkIfLoginInfoIsLoaded() {
1696
- return new Promise((resolve$2) => {
1696
+ return new Promise((resolve$1) => {
1697
1697
  const check = () => {
1698
1698
  if (!this.ctx["bilibili-notify-api"].getLoginInfoIsLoaded()) this.ctx.setTimeout(check, 500);
1699
- else resolve$2("success");
1699
+ else resolve$1("success");
1700
1700
  };
1701
1701
  check();
1702
1702
  });
@@ -4405,10 +4405,10 @@ var ServerManager = class extends koishi.Service {
4405
4405
  };
4406
4406
  disposePlugin = async () => {
4407
4407
  if (this.servers.length === 0) return false;
4408
- await new Promise((resolve$2) => {
4408
+ await new Promise((resolve$1) => {
4409
4409
  for (const fork of this.servers) fork.dispose();
4410
4410
  this.servers = [];
4411
- resolve$2("ok");
4411
+ resolve$1("ok");
4412
4412
  });
4413
4413
  return true;
4414
4414
  };
@@ -4418,15 +4418,15 @@ var ServerManager = class extends koishi.Service {
4418
4418
  return false;
4419
4419
  }
4420
4420
  await this.disposePlugin();
4421
- return new Promise((resolve$2) => {
4421
+ return new Promise((resolve$1) => {
4422
4422
  this.ctx.setTimeout(() => {
4423
4423
  try {
4424
4424
  this.registerPlugin();
4425
4425
  } catch (e) {
4426
4426
  this.logger.error("重启插件失败", e);
4427
- resolve$2(false);
4427
+ resolve$1(false);
4428
4428
  }
4429
- resolve$2(true);
4429
+ resolve$1(true);
4430
4430
  }, 1e3);
4431
4431
  });
4432
4432
  };
package/lib/index.mjs CHANGED
@@ -2,8 +2,6 @@ import "node:module";
2
2
  import { Schema, Service, Universal, h } from "koishi";
3
3
  import "@koishijs/plugin-notifier";
4
4
  import "@koishijs/plugin-help";
5
- import { pathToFileURL } from "node:url";
6
- import { resolve } from "node:path";
7
5
  import { GuardLevel, startListen } from "blive-message-listener";
8
6
  import QRCode from "qrcode";
9
7
  import { CronJob } from "cron";
@@ -11,6 +9,8 @@ import { DateTime } from "luxon";
11
9
  import { Jieba } from "@node-rs/jieba";
12
10
  import { dict } from "@node-rs/jieba/dict";
13
11
  import "koishi-plugin-puppeteer";
12
+ import { resolve } from "node:path";
13
+ import { pathToFileURL } from "node:url";
14
14
  import md5 from "md5";
15
15
  import crypto from "node:crypto";
16
16
  import http from "node:http";
@@ -1286,9 +1286,9 @@ var ComRegister = class {
1286
1286
  const liveData = { likedNum: "0" };
1287
1287
  const liveMsgObj = this.liveMsgManager.get(sub.uid);
1288
1288
  const guardLevelImg = {
1289
- [GuardLevel.Jianzhang]: pathToFileURL(resolve(__dirname, "img/captain.png")),
1290
- [GuardLevel.Tidu]: pathToFileURL(resolve(__dirname, "img/supervisor.png")),
1291
- [GuardLevel.Zongdu]: pathToFileURL(resolve(__dirname, "img/governor.png"))
1289
+ [GuardLevel.Jianzhang]: "https://s1.hdslb.com/bfs/static/blive/live-pay-mono/relation/relation/assets/captain-Bjw5Byb5.png",
1290
+ [GuardLevel.Tidu]: "https://s1.hdslb.com/bfs/static/blive/live-pay-mono/relation/relation/assets/supervisor-u43ElIjU.png",
1291
+ [GuardLevel.Zongdu]: "https://s1.hdslb.com/bfs/static/blive/live-pay-mono/relation/relation/assets/governor-DpDXKEdA.png"
1292
1292
  };
1293
1293
  const sendDanmakuWordCloudAndLiveSummary = async (customLiveSummary) => {
1294
1294
  this.logger.info("开始制作弹幕词云");
@@ -1428,7 +1428,7 @@ var ComRegister = class {
1428
1428
  },
1429
1429
  onGuardBuy: ({ body }) => {
1430
1430
  const guardImg = guardLevelImg[body.guard_level];
1431
- const content = h("message", [h.text(`【${masterInfo.username}的直播间】${body.user.uname}加入了大航海(${body.gift_name})`), h.image(guardImg.href)]);
1431
+ const content = h("message", [h.text(`【${masterInfo.username}的直播间】${body.user.uname}加入了大航海(${body.gift_name})`), h.image(guardImg)]);
1432
1432
  this.broadcastToTargets(sub.uid, content, PushType.LiveGuardBuy);
1433
1433
  },
1434
1434
  onLiveStart: async () => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-bilibili-notify",
3
3
  "description": "Koishi bilibili notify plugin",
4
- "version": "3.3.15",
4
+ "version": "3.4.0-alpha.1",
5
5
  "main": "./lib/index.cjs",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [