koishi-plugin-bilibili-notify 3.4.1 → 3.4.3

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
@@ -5,21 +5,30 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (all) => {
8
+ var __export = (all, symbols) => {
9
9
  let target = {};
10
- for (var name$2 in all) __defProp(target, name$2, {
11
- get: all[name$2],
12
- enumerable: true
13
- });
10
+ for (var name$2 in all) {
11
+ __defProp(target, name$2, {
12
+ get: all[name$2],
13
+ enumerable: true
14
+ });
15
+ }
16
+ if (symbols) {
17
+ __defProp(target, Symbol.toStringTag, { value: "Module" });
18
+ }
14
19
  return target;
15
20
  };
16
21
  var __copyProps = (to, from, except, desc) => {
17
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
18
- key = keys[i];
19
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
20
- get: ((k) => from[k]).bind(null, key),
21
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
22
- });
22
+ if (from && typeof from === "object" || typeof from === "function") {
23
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
24
+ key = keys[i];
25
+ if (!__hasOwnProp.call(to, key) && key !== except) {
26
+ __defProp(to, key, {
27
+ get: ((k) => from[k]).bind(null, key),
28
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
29
+ });
30
+ }
31
+ }
23
32
  }
24
33
  return to;
25
34
  };
@@ -720,7 +729,7 @@ var ComRegister = class ComRegister {
720
729
  guardLevel: blive_message_listener.GuardLevel.Jianzhang,
721
730
  face: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQSESgEED4WoyK9O5FFgrV8cHZPM4w4JgleZQ&s",
722
731
  uname: "恶魔兔",
723
- accompany: 56
732
+ isAdmin: 1
724
733
  }, {
725
734
  masterName: "籽岷",
726
735
  masterAvatarUrl: "https://img.touxiangkong.com/uploads/allimg/20203301251/2020/3/BjEbyu.jpg"
@@ -1470,14 +1479,12 @@ var ComRegister = class ComRegister {
1470
1479
  const content = (0, koishi.h)("message", [koishi.h.text(`【${masterInfo.username}的直播间】${body.user.uname}加入了大航海(${body.gift_name})`), koishi.h.image(guardImg)]);
1471
1480
  return this.broadcastToTargets(sub.uid, content, PushType.LiveGuardBuy);
1472
1481
  }
1473
- console.log(data);
1474
1482
  const userInfo = data.data;
1475
- console.log(userInfo);
1476
1483
  const buffer = await this.ctx["bilibili-notify-generate-img"].generateBoardingImg(guardImg, {
1477
1484
  guardLevel: body.guard_level,
1478
1485
  uname: userInfo.uname,
1479
1486
  face: userInfo.face,
1480
- accompany: userInfo.guard.accompany
1487
+ isAdmin: userInfo.is_admin
1481
1488
  }, {
1482
1489
  masterName: masterInfo.username,
1483
1490
  masterAvatarUrl: masterInfo.userface
@@ -2228,11 +2235,10 @@ var GenerateImg = class GenerateImg extends koishi.Service {
2228
2235
  [blive_message_listener.GuardLevel.Tidu]: ["#d8a0e6", "#b494e5"],
2229
2236
  [blive_message_listener.GuardLevel.Zongdu]: ["#f2a053", "#ef5f5f"]
2230
2237
  };
2231
- async generateBoardingImg(captainImgUrl, { guardLevel, uname, face, accompany }, { masterAvatarUrl, masterName }) {
2238
+ async generateBoardingImg(captainImgUrl, { guardLevel, uname, face, isAdmin }, { masterAvatarUrl, masterName }) {
2232
2239
  const bgColor = GenerateImg.BG_COLOR[guardLevel];
2233
2240
  const desc = {
2234
2241
  [blive_message_listener.GuardLevel.Jianzhang]: () => {
2235
- if (accompany && accompany > 0) return `"${uname}号"继续在<br/>"${masterName}"大航海舰队服役!`;
2236
2242
  return `"${uname}号"加入<br/>"${masterName}"大航海舰队!`;
2237
2243
  },
2238
2244
  [blive_message_listener.GuardLevel.Tidu]: () => {
@@ -2359,6 +2365,10 @@ var GenerateImg = class GenerateImg extends koishi.Service {
2359
2365
  }
2360
2366
 
2361
2367
  .accompany span {
2368
+ max-width: 85px;
2369
+ white-space: nowrap;
2370
+ text-overflow: ellipsis;
2371
+ overflow: hidden;
2362
2372
  color: white;
2363
2373
  font-size: 10px;
2364
2374
  font-weight: bold;
@@ -2395,7 +2405,7 @@ var GenerateImg = class GenerateImg extends koishi.Service {
2395
2405
  <span>${uname}</span>
2396
2406
  </div>
2397
2407
  <div class="accompany">
2398
- <div class="master-avatar"></div><span>已服役 ${accompany} 天</span>
2408
+ <div class="master-avatar"></div><span>${isAdmin ? "房管" : masterName}</span>
2399
2409
  </div>
2400
2410
  </div>
2401
2411
  </div>
package/lib/index.mjs CHANGED
@@ -22,12 +22,17 @@ import OpenAI from "openai";
22
22
 
23
23
  //#region rolldown:runtime
24
24
  var __defProp = Object.defineProperty;
25
- var __export = (all) => {
25
+ var __export = (all, symbols) => {
26
26
  let target = {};
27
- for (var name$2 in all) __defProp(target, name$2, {
28
- get: all[name$2],
29
- enumerable: true
30
- });
27
+ for (var name$2 in all) {
28
+ __defProp(target, name$2, {
29
+ get: all[name$2],
30
+ enumerable: true
31
+ });
32
+ }
33
+ if (symbols) {
34
+ __defProp(target, Symbol.toStringTag, { value: "Module" });
35
+ }
31
36
  return target;
32
37
  };
33
38
 
@@ -695,7 +700,7 @@ var ComRegister = class ComRegister {
695
700
  guardLevel: GuardLevel.Jianzhang,
696
701
  face: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQSESgEED4WoyK9O5FFgrV8cHZPM4w4JgleZQ&s",
697
702
  uname: "恶魔兔",
698
- accompany: 56
703
+ isAdmin: 1
699
704
  }, {
700
705
  masterName: "籽岷",
701
706
  masterAvatarUrl: "https://img.touxiangkong.com/uploads/allimg/20203301251/2020/3/BjEbyu.jpg"
@@ -1445,14 +1450,12 @@ var ComRegister = class ComRegister {
1445
1450
  const content = h("message", [h.text(`【${masterInfo.username}的直播间】${body.user.uname}加入了大航海(${body.gift_name})`), h.image(guardImg)]);
1446
1451
  return this.broadcastToTargets(sub.uid, content, PushType.LiveGuardBuy);
1447
1452
  }
1448
- console.log(data);
1449
1453
  const userInfo = data.data;
1450
- console.log(userInfo);
1451
1454
  const buffer = await this.ctx["bilibili-notify-generate-img"].generateBoardingImg(guardImg, {
1452
1455
  guardLevel: body.guard_level,
1453
1456
  uname: userInfo.uname,
1454
1457
  face: userInfo.face,
1455
- accompany: userInfo.guard.accompany
1458
+ isAdmin: userInfo.is_admin
1456
1459
  }, {
1457
1460
  masterName: masterInfo.username,
1458
1461
  masterAvatarUrl: masterInfo.userface
@@ -2203,11 +2206,10 @@ var GenerateImg = class GenerateImg extends Service {
2203
2206
  [GuardLevel.Tidu]: ["#d8a0e6", "#b494e5"],
2204
2207
  [GuardLevel.Zongdu]: ["#f2a053", "#ef5f5f"]
2205
2208
  };
2206
- async generateBoardingImg(captainImgUrl, { guardLevel, uname, face, accompany }, { masterAvatarUrl, masterName }) {
2209
+ async generateBoardingImg(captainImgUrl, { guardLevel, uname, face, isAdmin }, { masterAvatarUrl, masterName }) {
2207
2210
  const bgColor = GenerateImg.BG_COLOR[guardLevel];
2208
2211
  const desc = {
2209
2212
  [GuardLevel.Jianzhang]: () => {
2210
- if (accompany && accompany > 0) return `"${uname}号"继续在<br/>"${masterName}"大航海舰队服役!`;
2211
2213
  return `"${uname}号"加入<br/>"${masterName}"大航海舰队!`;
2212
2214
  },
2213
2215
  [GuardLevel.Tidu]: () => {
@@ -2334,6 +2336,10 @@ var GenerateImg = class GenerateImg extends Service {
2334
2336
  }
2335
2337
 
2336
2338
  .accompany span {
2339
+ max-width: 85px;
2340
+ white-space: nowrap;
2341
+ text-overflow: ellipsis;
2342
+ overflow: hidden;
2337
2343
  color: white;
2338
2344
  font-size: 10px;
2339
2345
  font-weight: bold;
@@ -2370,7 +2376,7 @@ var GenerateImg = class GenerateImg extends Service {
2370
2376
  <span>${uname}</span>
2371
2377
  </div>
2372
2378
  <div class="accompany">
2373
- <div class="master-avatar"></div><span>已服役 ${accompany} 天</span>
2379
+ <div class="master-avatar"></div><span>${isAdmin ? "房管" : masterName}</span>
2374
2380
  </div>
2375
2381
  </div>
2376
2382
  </div>
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.4.1",
4
+ "version": "3.4.3",
5
5
  "main": "./lib/index.cjs",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [