koishi-plugin-bilibili-notify 3.4.0 → 3.4.2
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 +6 -9
- package/lib/index.mjs +5 -8
- package/package.json +2 -2
package/lib/index.cjs
CHANGED
|
@@ -52,6 +52,7 @@ let node_https = require("node:https");
|
|
|
52
52
|
node_https = __toESM(node_https);
|
|
53
53
|
let axios = require("axios");
|
|
54
54
|
axios = __toESM(axios);
|
|
55
|
+
let jsdom = require("jsdom");
|
|
55
56
|
let tough_cookie = require("tough-cookie");
|
|
56
57
|
let openai = require("openai");
|
|
57
58
|
openai = __toESM(openai);
|
|
@@ -719,7 +720,7 @@ var ComRegister = class ComRegister {
|
|
|
719
720
|
guardLevel: blive_message_listener.GuardLevel.Jianzhang,
|
|
720
721
|
face: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQSESgEED4WoyK9O5FFgrV8cHZPM4w4JgleZQ&s",
|
|
721
722
|
uname: "恶魔兔",
|
|
722
|
-
|
|
723
|
+
isAdmin: 1
|
|
723
724
|
}, {
|
|
724
725
|
masterName: "籽岷",
|
|
725
726
|
masterAvatarUrl: "https://img.touxiangkong.com/uploads/allimg/20203301251/2020/3/BjEbyu.jpg"
|
|
@@ -1469,14 +1470,12 @@ var ComRegister = class ComRegister {
|
|
|
1469
1470
|
const content = (0, koishi.h)("message", [koishi.h.text(`【${masterInfo.username}的直播间】${body.user.uname}加入了大航海(${body.gift_name})`), koishi.h.image(guardImg)]);
|
|
1470
1471
|
return this.broadcastToTargets(sub.uid, content, PushType.LiveGuardBuy);
|
|
1471
1472
|
}
|
|
1472
|
-
console.log(data);
|
|
1473
1473
|
const userInfo = data.data;
|
|
1474
|
-
console.log(userInfo);
|
|
1475
1474
|
const buffer = await this.ctx["bilibili-notify-generate-img"].generateBoardingImg(guardImg, {
|
|
1476
1475
|
guardLevel: body.guard_level,
|
|
1477
1476
|
uname: userInfo.uname,
|
|
1478
1477
|
face: userInfo.face,
|
|
1479
|
-
|
|
1478
|
+
isAdmin: userInfo.is_admin
|
|
1480
1479
|
}, {
|
|
1481
1480
|
masterName: masterInfo.username,
|
|
1482
1481
|
masterAvatarUrl: masterInfo.userface
|
|
@@ -2227,11 +2226,10 @@ var GenerateImg = class GenerateImg extends koishi.Service {
|
|
|
2227
2226
|
[blive_message_listener.GuardLevel.Tidu]: ["#d8a0e6", "#b494e5"],
|
|
2228
2227
|
[blive_message_listener.GuardLevel.Zongdu]: ["#f2a053", "#ef5f5f"]
|
|
2229
2228
|
};
|
|
2230
|
-
async generateBoardingImg(captainImgUrl, { guardLevel, uname, face,
|
|
2229
|
+
async generateBoardingImg(captainImgUrl, { guardLevel, uname, face, isAdmin }, { masterAvatarUrl, masterName }) {
|
|
2231
2230
|
const bgColor = GenerateImg.BG_COLOR[guardLevel];
|
|
2232
2231
|
const desc = {
|
|
2233
2232
|
[blive_message_listener.GuardLevel.Jianzhang]: () => {
|
|
2234
|
-
if (accompany && accompany > 0) return `"${uname}号"继续在<br/>"${masterName}"大航海舰队服役!`;
|
|
2235
2233
|
return `"${uname}号"加入<br/>"${masterName}"大航海舰队!`;
|
|
2236
2234
|
},
|
|
2237
2235
|
[blive_message_listener.GuardLevel.Tidu]: () => {
|
|
@@ -2394,7 +2392,7 @@ var GenerateImg = class GenerateImg extends koishi.Service {
|
|
|
2394
2392
|
<span>${uname}</span>
|
|
2395
2393
|
</div>
|
|
2396
2394
|
<div class="accompany">
|
|
2397
|
-
<div class="master-avatar"></div><span
|
|
2395
|
+
<div class="master-avatar"></div><span>${masterName} ${isAdmin ? "房管认证" : ""}</span>
|
|
2398
2396
|
</div>
|
|
2399
2397
|
</div>
|
|
2400
2398
|
</div>
|
|
@@ -4411,8 +4409,7 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4411
4409
|
}
|
|
4412
4410
|
const correspondPath = await getCorrespondPath(luxon.DateTime.now().toMillis());
|
|
4413
4411
|
const { data: refreshCsrfHtml } = await this.client.get(`https://www.bilibili.com/correspond/1/${correspondPath}`);
|
|
4414
|
-
const {
|
|
4415
|
-
const { document } = new JSDOM(refreshCsrfHtml).window;
|
|
4412
|
+
const { document } = new jsdom.JSDOM(refreshCsrfHtml).window;
|
|
4416
4413
|
const targetElement = document.getElementById("1-name");
|
|
4417
4414
|
const refresh_csrf = targetElement ? targetElement.textContent : null;
|
|
4418
4415
|
const { data: refreshData } = await this.client.post("https://passport.bilibili.com/x/passport-login/web/cookie/refresh", {
|
package/lib/index.mjs
CHANGED
|
@@ -16,6 +16,7 @@ import crypto from "node:crypto";
|
|
|
16
16
|
import http from "node:http";
|
|
17
17
|
import https from "node:https";
|
|
18
18
|
import axios from "axios";
|
|
19
|
+
import { JSDOM } from "jsdom";
|
|
19
20
|
import { Cookie, CookieJar } from "tough-cookie";
|
|
20
21
|
import OpenAI from "openai";
|
|
21
22
|
|
|
@@ -694,7 +695,7 @@ var ComRegister = class ComRegister {
|
|
|
694
695
|
guardLevel: GuardLevel.Jianzhang,
|
|
695
696
|
face: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQSESgEED4WoyK9O5FFgrV8cHZPM4w4JgleZQ&s",
|
|
696
697
|
uname: "恶魔兔",
|
|
697
|
-
|
|
698
|
+
isAdmin: 1
|
|
698
699
|
}, {
|
|
699
700
|
masterName: "籽岷",
|
|
700
701
|
masterAvatarUrl: "https://img.touxiangkong.com/uploads/allimg/20203301251/2020/3/BjEbyu.jpg"
|
|
@@ -1444,14 +1445,12 @@ var ComRegister = class ComRegister {
|
|
|
1444
1445
|
const content = h("message", [h.text(`【${masterInfo.username}的直播间】${body.user.uname}加入了大航海(${body.gift_name})`), h.image(guardImg)]);
|
|
1445
1446
|
return this.broadcastToTargets(sub.uid, content, PushType.LiveGuardBuy);
|
|
1446
1447
|
}
|
|
1447
|
-
console.log(data);
|
|
1448
1448
|
const userInfo = data.data;
|
|
1449
|
-
console.log(userInfo);
|
|
1450
1449
|
const buffer = await this.ctx["bilibili-notify-generate-img"].generateBoardingImg(guardImg, {
|
|
1451
1450
|
guardLevel: body.guard_level,
|
|
1452
1451
|
uname: userInfo.uname,
|
|
1453
1452
|
face: userInfo.face,
|
|
1454
|
-
|
|
1453
|
+
isAdmin: userInfo.is_admin
|
|
1455
1454
|
}, {
|
|
1456
1455
|
masterName: masterInfo.username,
|
|
1457
1456
|
masterAvatarUrl: masterInfo.userface
|
|
@@ -2202,11 +2201,10 @@ var GenerateImg = class GenerateImg extends Service {
|
|
|
2202
2201
|
[GuardLevel.Tidu]: ["#d8a0e6", "#b494e5"],
|
|
2203
2202
|
[GuardLevel.Zongdu]: ["#f2a053", "#ef5f5f"]
|
|
2204
2203
|
};
|
|
2205
|
-
async generateBoardingImg(captainImgUrl, { guardLevel, uname, face,
|
|
2204
|
+
async generateBoardingImg(captainImgUrl, { guardLevel, uname, face, isAdmin }, { masterAvatarUrl, masterName }) {
|
|
2206
2205
|
const bgColor = GenerateImg.BG_COLOR[guardLevel];
|
|
2207
2206
|
const desc = {
|
|
2208
2207
|
[GuardLevel.Jianzhang]: () => {
|
|
2209
|
-
if (accompany && accompany > 0) return `"${uname}号"继续在<br/>"${masterName}"大航海舰队服役!`;
|
|
2210
2208
|
return `"${uname}号"加入<br/>"${masterName}"大航海舰队!`;
|
|
2211
2209
|
},
|
|
2212
2210
|
[GuardLevel.Tidu]: () => {
|
|
@@ -2369,7 +2367,7 @@ var GenerateImg = class GenerateImg extends Service {
|
|
|
2369
2367
|
<span>${uname}</span>
|
|
2370
2368
|
</div>
|
|
2371
2369
|
<div class="accompany">
|
|
2372
|
-
<div class="master-avatar"></div><span
|
|
2370
|
+
<div class="master-avatar"></div><span>${masterName} ${isAdmin ? "房管认证" : ""}</span>
|
|
2373
2371
|
</div>
|
|
2374
2372
|
</div>
|
|
2375
2373
|
</div>
|
|
@@ -4386,7 +4384,6 @@ var BiliAPI = class extends Service {
|
|
|
4386
4384
|
}
|
|
4387
4385
|
const correspondPath = await getCorrespondPath(DateTime.now().toMillis());
|
|
4388
4386
|
const { data: refreshCsrfHtml } = await this.client.get(`https://www.bilibili.com/correspond/1/${correspondPath}`);
|
|
4389
|
-
const { JSDOM } = await import("jsdom");
|
|
4390
4387
|
const { document } = new JSDOM(refreshCsrfHtml).window;
|
|
4391
4388
|
const targetElement = document.getElementById("1-name");
|
|
4392
4389
|
const refresh_csrf = targetElement ? targetElement.textContent : null;
|
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.
|
|
4
|
+
"version": "3.4.2",
|
|
5
5
|
"main": "./lib/index.cjs",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"blive-message-listener": "^0.5.2",
|
|
35
35
|
"cacheable-lookup": "^7.0.0",
|
|
36
36
|
"cron": "^4.3.3",
|
|
37
|
-
"jsdom": "^
|
|
37
|
+
"jsdom": "^26.1.0",
|
|
38
38
|
"luxon": "^3.8.0-alpha.1",
|
|
39
39
|
"md5": "^2.3.0",
|
|
40
40
|
"openai": "^6.8.1",
|