koishi-plugin-bilibili-notify 3.3.9 → 3.3.10

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 (3) hide show
  1. package/lib/index.js +16 -15
  2. package/lib/index.mjs +16 -15
  3. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -1610,7 +1610,7 @@ var ComRegister$1 = class {
1610
1610
  };
1611
1611
  }
1612
1612
  async subUserInBili(mid) {
1613
- for (const user of this.groupInfo) if (user.mid === mid) return {
1613
+ for (const user of this.groupInfo) if (user.mid.toString() === mid) return {
1614
1614
  code: 0,
1615
1615
  message: "订阅对象已存在于分组中"
1616
1616
  };
@@ -1699,6 +1699,19 @@ var ComRegister$1 = class {
1699
1699
  this.preInitConfig(subs);
1700
1700
  for (const sub of Object.values(subs)) {
1701
1701
  this.logger.info(`加载订阅UID:${sub.uid}中...`);
1702
+ const subInfo = await this.subUserInBili(sub.uid);
1703
+ if (subInfo.code !== 0 && subInfo.code !== 22015) return subInfo;
1704
+ if (subInfo.code === 22015) this.logger.warn(`账号异常,无法进行订阅操作,请手动订阅 UID:${sub.uid} 备注:${sub.uname}`);
1705
+ this.subManager.set(sub.uid, {
1706
+ uname: sub.uname,
1707
+ roomId: sub.roomid,
1708
+ target: sub.target,
1709
+ live: sub.live,
1710
+ dynamic: sub.dynamic,
1711
+ customCardStyle: sub.customCardStyle,
1712
+ customLiveMsg: sub.customLiveMsg,
1713
+ customLiveSummary: sub.customLiveSummary
1714
+ });
1702
1715
  if (sub.live && !sub.roomid) {
1703
1716
  this.logger.info(`UID:${sub.uid} 请求了用户接口~`);
1704
1717
  const { code: userInfoCode, message: userInfoMsg, data: userInfoData } = await withRetry(async () => {
@@ -1730,18 +1743,6 @@ var ComRegister$1 = class {
1730
1743
  sub.roomid = userInfoData.live_room?.roomid;
1731
1744
  }
1732
1745
  if (sub.live && sub.roomid && this.config.liveDetectType === "WS") await this.liveDetectWithListener(sub);
1733
- const subInfo = await this.subUserInBili(sub.uid);
1734
- if (subInfo.code !== 0) return subInfo;
1735
- this.subManager.set(sub.uid, {
1736
- uname: sub.uname,
1737
- roomId: sub.roomid,
1738
- target: sub.target,
1739
- live: sub.live,
1740
- dynamic: sub.dynamic,
1741
- customCardStyle: sub.customCardStyle,
1742
- customLiveMsg: sub.customLiveMsg,
1743
- customLiveSummary: sub.customLiveSummary
1744
- });
1745
1746
  this.logger.info(`UID:${sub.uid} 订阅加载完毕!`);
1746
1747
  if (sub !== Object.values(subs).pop()) {
1747
1748
  const randomDelay = Math.floor(Math.random() * 3) + 1;
@@ -3853,8 +3854,8 @@ var BiliAPI$1 = class extends koishi.Service {
3853
3854
  headers: {
3854
3855
  "Content-Type": "application/json",
3855
3856
  "User-Agent": this.apiConfig.userAgent || "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0",
3856
- Origin: "https://space.bilibili.com",
3857
- Referer: "https://space.bilibili.com/",
3857
+ Origin: "https://www.bilibili.com",
3858
+ Referer: "https://www.bilibili.com/",
3858
3859
  priority: "u=1, i",
3859
3860
  "sec-ch-ua": "\"Not;A=Brand\";v=\"99\", \"Google Chrome\";v=\"139\", \"Chromium\";v=\"139\"",
3860
3861
  "sec-ch-ua-mobile": "?0",
package/lib/index.mjs CHANGED
@@ -1592,7 +1592,7 @@ var ComRegister$1 = class {
1592
1592
  };
1593
1593
  }
1594
1594
  async subUserInBili(mid) {
1595
- for (const user of this.groupInfo) if (user.mid === mid) return {
1595
+ for (const user of this.groupInfo) if (user.mid.toString() === mid) return {
1596
1596
  code: 0,
1597
1597
  message: "订阅对象已存在于分组中"
1598
1598
  };
@@ -1681,6 +1681,19 @@ var ComRegister$1 = class {
1681
1681
  this.preInitConfig(subs);
1682
1682
  for (const sub of Object.values(subs)) {
1683
1683
  this.logger.info(`加载订阅UID:${sub.uid}中...`);
1684
+ const subInfo = await this.subUserInBili(sub.uid);
1685
+ if (subInfo.code !== 0 && subInfo.code !== 22015) return subInfo;
1686
+ if (subInfo.code === 22015) this.logger.warn(`账号异常,无法进行订阅操作,请手动订阅 UID:${sub.uid} 备注:${sub.uname}`);
1687
+ this.subManager.set(sub.uid, {
1688
+ uname: sub.uname,
1689
+ roomId: sub.roomid,
1690
+ target: sub.target,
1691
+ live: sub.live,
1692
+ dynamic: sub.dynamic,
1693
+ customCardStyle: sub.customCardStyle,
1694
+ customLiveMsg: sub.customLiveMsg,
1695
+ customLiveSummary: sub.customLiveSummary
1696
+ });
1684
1697
  if (sub.live && !sub.roomid) {
1685
1698
  this.logger.info(`UID:${sub.uid} 请求了用户接口~`);
1686
1699
  const { code: userInfoCode, message: userInfoMsg, data: userInfoData } = await withRetry(async () => {
@@ -1712,18 +1725,6 @@ var ComRegister$1 = class {
1712
1725
  sub.roomid = userInfoData.live_room?.roomid;
1713
1726
  }
1714
1727
  if (sub.live && sub.roomid && this.config.liveDetectType === "WS") await this.liveDetectWithListener(sub);
1715
- const subInfo = await this.subUserInBili(sub.uid);
1716
- if (subInfo.code !== 0) return subInfo;
1717
- this.subManager.set(sub.uid, {
1718
- uname: sub.uname,
1719
- roomId: sub.roomid,
1720
- target: sub.target,
1721
- live: sub.live,
1722
- dynamic: sub.dynamic,
1723
- customCardStyle: sub.customCardStyle,
1724
- customLiveMsg: sub.customLiveMsg,
1725
- customLiveSummary: sub.customLiveSummary
1726
- });
1727
1728
  this.logger.info(`UID:${sub.uid} 订阅加载完毕!`);
1728
1729
  if (sub !== Object.values(subs).pop()) {
1729
1730
  const randomDelay = Math.floor(Math.random() * 3) + 1;
@@ -3835,8 +3836,8 @@ var BiliAPI$1 = class extends Service {
3835
3836
  headers: {
3836
3837
  "Content-Type": "application/json",
3837
3838
  "User-Agent": this.apiConfig.userAgent || "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0",
3838
- Origin: "https://space.bilibili.com",
3839
- Referer: "https://space.bilibili.com/",
3839
+ Origin: "https://www.bilibili.com",
3840
+ Referer: "https://www.bilibili.com/",
3840
3841
  priority: "u=1, i",
3841
3842
  "sec-ch-ua": "\"Not;A=Brand\";v=\"99\", \"Google Chrome\";v=\"139\", \"Chromium\";v=\"139\"",
3842
3843
  "sec-ch-ua-mobile": "?0",
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.9",
4
+ "version": "3.3.10",
5
5
  "main": "./lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [