koishi-plugin-bilibili-notify 3.7.2 → 3.8.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/dist/index.js +1 -1
- package/lib/index.cjs +74 -31
- package/lib/index.d.cts +14 -0
- package/lib/index.d.mts +14 -0
- package/lib/index.mjs +74 -31
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineComponent as F,inject as T,ref as c,watch as D,resolveComponent as S,
|
|
1
|
+
import{defineComponent as F,inject as T,ref as c,watch as D,resolveComponent as S,openBlock as i,createElementBlock as o,Fragment as N,createElementVNode as e,toDisplayString as a,createCommentVNode as u,createBlock as f,withCtx as d,createVNode as y,createTextVNode as b,withDirectives as E,vShow as M}from"vue";import{store as m,send as g}from"@koishijs/client";const $={key:0,class:"loading-wrapper"},j={class:"comment"},A={key:0,class:"comment"},G=["src"],L={key:1,class:"comment"},O={class:"comment"},R={class:"comment"},z={key:0,class:"loading-wrapper"},H={key:1,class:"logged-in fade-in"},J={class:"user-bg-wrapper"},K=["src"],P={class:"user-info"},Q=["src"],U={class:"name-sign"},W={class:"udesc"},X={class:"uname"},Y=["src"],Z={class:"usign"},e1={class:"user-status"},t1=F({__name:"settings",setup(w){const I=T("manager.settings.local"),C=c(""),q=c(""),x=c(""),p=c(""),s=c({}),h=c(false),l=c(""),B=c(false);D(()=>[m["bilibili-notify"].status,m["bilibili-notify"].msg],async()=>{if(I.value.name==="koishi-plugin-bilibili-notify")switch(s.value=m["bilibili-notify"],m["bilibili-notify"].status){case 1:return l.value="loading";case 0:return l.value="not_login";case 5:{const r=setTimeout(()=>{B.value=true},6e4),t=m["bilibili-notify"].data,v=async()=>{await g("bilibili-notify/request-cors",t.card.face).then(async n=>{C.value=n}),await g("bilibili-notify/request-cors",t.space.l_img).then(async n=>{q.value=n}),await g("bilibili-notify/request-cors",t.card.vip.label.img_label_uri_hans_static).then(async n=>{x.value=n}),clearTimeout(r),h.value=true};l.value="logged_in",await v();return}case 2:return p.value=s.value.data,l.value="logging_qr";case 3:return l.value="logging_qr";case 4:return l.value="logging_in";case 7:return l.value="login_failed";case 6:return l.value="login_success"}},{immediate:true});const _=()=>{g("bilibili-notify/start-login")},V=()=>{g("bilibili-notify/restart-plugin")},k=r=>r>=1e8?(r/1e8).toFixed(1).replace(/\.0$/,"")+"亿":r>=1e4?(r/1e4).toFixed(1).replace(/\.0$/,"")+"万":r.toString();return(r,t)=>{const v=S("k-button"),n=S("k-comment");return i(),o(N,null,[l.value==="loading"?(i(),o("div",$,[t[0]||(t[0]=e("div",{class:"spinner"},null,-1)),e("p",null,a(s.value.msg),1)])):u("v-if",true),l.value==="not_login"?(i(),f(n,{key:1,type:"error"},{default:d(()=>[e("div",j,[e("p",null,a(s.value.msg),1),y(v,{onClick:_},{default:d(()=>[...t[1]||(t[1]=[b("登录",-1)])]),_:1})])]),_:1})):u("v-if",true),l.value==="logging_qr"?(i(),f(n,{key:2,type:"warning"},{default:d(()=>[p.value?(i(),o("div",A,[t[2]||(t[2]=e("p",null,"请使用Bilibili App扫码登录",-1)),e("img",{class:"qrcode",src:p.value,alt:"qrcode"},null,8,G),e("p",null,a(s.value.msg),1)])):u("v-if",true),p.value?u("v-if",true):(i(),o("div",L,[t[4]||(t[4]=e("p",null,"二维码显示失败,请重新登录",-1)),y(v,{onClick:_},{default:d(()=>[...t[3]||(t[3]=[b("重新登录",-1)])]),_:1})]))]),_:1})):u("v-if",true),l.value==="login_failed"?(i(),f(n,{key:3,type:"error"},{default:d(()=>[e("div",O,[e("p",null,a(s.value.msg),1),y(v,{onClick:_},{default:d(()=>[...t[5]||(t[5]=[b("重新登录",-1)])]),_:1})])]),_:1})):u("v-if",true),l.value==="login_success"?(i(),f(n,{key:4,type:"success"},{default:d(()=>[e("div",R,[e("p",null,a(s.value.msg),1),y(v,{onClick:V},{default:d(()=>[...t[6]||(t[6]=[b("重启插件",-1)])]),_:1})])]),_:1})):u("v-if",true),l.value==="logged_in"?(i(),o(N,{key:5},[h.value?(i(),o("div",H,[e("div",J,[e("img",{class:"user-bg",src:q.value,alt:"user-bg"},null,8,K)]),e("div",P,[e("img",{class:"avatar",src:C.value,alt:"avatar"},null,8,Q),e("div",U,[e("div",W,[e("span",X,a(s.value.data.card.name),1),s.value.data.card.vip.vipStatus===1?(i(),o("img",{key:0,class:"uvip",src:x.value,alt:"vip"},null,8,Y)):u("v-if",true)]),e("span",Z,a(s.value.data.card.sign),1)])]),e("div",e1,[e("div",null,[t[10]||(t[10]=e("span",null,"关注数",-1)),e("span",null,a(k(s.value.data.card.attention)),1)]),e("div",null,[t[11]||(t[11]=e("span",null,"粉丝数",-1)),e("span",null,a(k(s.value.data.card.fans)),1)]),e("div",null,[t[12]||(t[12]=e("span",null,"获赞数",-1)),e("span",null,a(k(s.value.data.like_num)),1)])]),(i(),o("svg",{onClick:_,class:"logo",t:"1645466458357",viewBox:"0 0 2299 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"2663",width:"180",style:{fill:"var(--bew-theme-color)"}},[...t[13]||(t[13]=[e("path",{d:"M1775.840814 322.588002c6.0164 1.002733 53.144869-9.525967 55.150336-6.016401 3.0082 4.5123 24.065601 155.92504 18.550567 156.927774s-44.621635 10.027334-44.621635 10.027334c-3.0082-20.556034-28.577901-147.903173-29.079268-160.938707m75.205003-14.539634l20.556034 162.944174c10.5287-0.501367 53.144869-3.509567 57.155803-4.010934-6.0164-61.668103-16.545101-158.933241-16.545101-158.93324-20.054668-4.010934-41.112069-4.010934-61.166736 0m-40.610702 226.116376s92.752838-23.564234 126.344406-12.0328c17.046467 61.668103 48.131202 407.611118 51.139402 421.649386-21.057401 2.506833-90.246004 8.523234-95.761037 10.027333-4.5123-26.071068-81.72277-403.098818-81.722771-419.643919m343.436183-207.565809c5.515034 1.5041 54.648969-5.013667 55.150335-1.5041 1.002733 12.032801 6.0164 157.42914 0.501367 157.930507s-44.621635 4.010934-44.621635 4.010934c-1.002733-20.054668-12.032801-146.90044-11.030067-160.437341m75.70637-4.010933l4.010933 160.938707c10.5287 0 52.643502 2.506833 57.155803 2.005467-1.002733-61.668103 0-158.933241 0-158.933241-20.054668-3.509567-40.610702-5.013667-61.166736-4.010933m-64.676303 216.089043s94.758304-12.534167 126.845772 2.506833c7.019134 72.196803 6.0164 408.613852 7.019134 422.652119-21.558768 0-90.246004 1.002733-95.761038 2.005467-1.002733-26.071068-39.607968-410.619319-38.103868-427.164419m-220.099977-413.627519c54.648969 278.759879 96.262404 755.058234 97.766504 785.641602 0 0 43.117535 1.002733 91.750105 4.010934C2105.740095 614.383415 2070.644427 134.575493 2071.145794 119.033126c-12.032801-13.536901-126.344406 6.0164-126.344406 6.0164m-120.328005 659.297196c-10.5287-78.213204-290.291313-166.955108-447.720454-138.377206 0 0-19.553301-172.470141-27.073801-339.425248-6.517767-143.390873-1.002733-282.770813 0.501366-305.833681-10.5287-7.5205-123.837572 46.627102-185.004308 69.188603 0 0 73.199537 309.844614 126.344406 952.59671 0 0 84.730971 9.0246 230.12731-19.051934s317.365114-115.815705 302.825481-219.097244m-341.932083 140.88404l-24.566967-176.982441c6.0164-3.0082 156.927774 53.144869 172.971507 63.172203-2.506833 11.030067-148.40454 113.810238-148.40454 113.810238M610.664628 322.588002c6.0164 1.002733 53.144869-9.525967 55.150335-6.016401 3.0082 4.5123 24.065601 155.92504 18.550568 156.927774s-44.621635 10.027334-44.621635 10.027334c-3.0082-20.556034-28.577901-147.903173-29.079268-160.938707m75.205003-14.539634l20.556034 162.944174c10.5287-0.501367 53.144869-3.509567 57.155803-4.010934-6.517767-61.668103-16.545101-158.933241-16.545101-158.93324-20.054668-4.010934-41.112069-4.010934-61.166736 0m-40.610702 226.116376s92.752838-23.564234 126.344406-12.0328c17.046467 61.668103 48.131202 407.611118 51.139402 421.649386-21.057401 2.506833-90.246004 8.523234-95.761037 10.027333-4.5123-26.071068-81.72277-403.098818-81.722771-419.643919m343.436182-207.565809c5.515034 1.5041 54.648969-5.013667 55.150336-1.5041 1.002733 12.032801 6.0164 157.42914 0.501367 157.930507s-44.621635 4.010934-44.621635 4.010934c-1.002733-20.054668-11.531434-146.90044-11.030068-160.437341m75.706371-4.010933l4.010933 160.938707c10.5287 0 52.643502 2.506833 57.155803 2.005467-1.002733-61.668103 0-158.933241 0-158.933241-20.054668-3.509567-40.610702-4.5123-61.166736-4.010933m-64.676303 216.089043s94.758304-12.534167 126.845772 2.506833c7.019134 72.196803 6.0164 408.613852 7.019134 422.652119-21.558768 0-90.246004 1.002733-95.761038 2.005467-0.501367-26.071068-39.607968-410.619319-38.103868-427.164419m-220.099977-413.627519c54.648969 278.759879 96.262404 755.058234 97.766504 785.641602 0 0 43.117535 1.002733 91.750105 4.010934-28.577901-300.318647-63.67357-780.126569-63.172203-796.170303-12.032801-13.035534-126.344406 6.517767-126.344406 6.517767m-120.328005 659.297196c-10.5287-78.213204-290.291313-166.955108-447.720454-138.377206 0 0-19.553301-172.470141-27.073801-339.425248-6.517767-143.390873-1.002733-282.770813 0.501366-305.833681C174.475608-6.308547 61.166736 47.337689 0 69.89919c0 0 73.199537 309.844614 126.344406 952.59671 0 0 84.730971 9.0246 230.12731-19.051934s317.365114-115.815705 302.825481-219.097244m-341.932083 140.88404l-24.566967-176.982441c6.0164-3.0082 156.927774 53.144869 172.971507 63.172203-2.506833 11.030067-148.40454 113.810238-148.40454 113.810238","p-id":"2664"},null,-1)])]))])):(i(),o("div",z,[t[8]||(t[8]=e("div",{class:"spinner"},null,-1)),t[9]||(t[9]=e("p",null,"正在加载登录账号信息中...",-1)),E(e("div",null,[...t[7]||(t[7]=[e("span",null,"加载太久?可能是网络错误,可以尝试切换到其他插件页再切回来;加载不出来也不影响使用哦~",-1)])],512),[[M,B.value]])]))],64)):u("v-if",true)],64)}}}),i1=w=>{w.slot({type:"plugin-details",component:t1,order:0})};export{i1 as default};
|
package/lib/index.cjs
CHANGED
|
@@ -182,6 +182,8 @@ let PushType = /* @__PURE__ */ function(PushType$1) {
|
|
|
182
182
|
PushType$1[PushType$1["LiveGuardBuy"] = 4] = "LiveGuardBuy";
|
|
183
183
|
PushType$1[PushType$1["WordCloudAndLiveSummary"] = 5] = "WordCloudAndLiveSummary";
|
|
184
184
|
PushType$1[PushType$1["Superchat"] = 6] = "Superchat";
|
|
185
|
+
PushType$1[PushType$1["UserDanmakuMsg"] = 7] = "UserDanmakuMsg";
|
|
186
|
+
PushType$1[PushType$1["UserActions"] = 8] = "UserActions";
|
|
185
187
|
return PushType$1;
|
|
186
188
|
}({});
|
|
187
189
|
const PushTypeMsg = {
|
|
@@ -191,7 +193,9 @@ const PushTypeMsg = {
|
|
|
191
193
|
[PushType.StartBroadcasting]: "开播推送",
|
|
192
194
|
[PushType.LiveGuardBuy]: "上舰推送",
|
|
193
195
|
[PushType.WordCloudAndLiveSummary]: "弹幕词云和直播总结推送",
|
|
194
|
-
[PushType.Superchat]: "SC推送"
|
|
196
|
+
[PushType.Superchat]: "SC推送",
|
|
197
|
+
[PushType.UserDanmakuMsg]: "用户弹幕推送",
|
|
198
|
+
[PushType.UserActions]: "用户行为推送"
|
|
195
199
|
};
|
|
196
200
|
let BiliLoginStatus = /* @__PURE__ */ function(BiliLoginStatus$1) {
|
|
197
201
|
BiliLoginStatus$1[BiliLoginStatus$1["NOT_LOGIN"] = 0] = "NOT_LOGIN";
|
|
@@ -670,7 +674,7 @@ var BilibiliNotifyLive = class BilibiliNotifyLive extends koishi.Service {
|
|
|
670
674
|
const LIVE_EVENT_COOLDOWN = 10 * 1e3;
|
|
671
675
|
let lastLiveStart = 0;
|
|
672
676
|
let lastLiveEnd = 0;
|
|
673
|
-
|
|
677
|
+
const handler = {
|
|
674
678
|
onError: async () => {
|
|
675
679
|
liveStatus = false;
|
|
676
680
|
pushAtTimeTimer?.();
|
|
@@ -682,6 +686,11 @@ var BilibiliNotifyLive = class BilibiliNotifyLive extends koishi.Service {
|
|
|
682
686
|
onIncomeDanmu: ({ body }) => {
|
|
683
687
|
this.segmentDanmaku(body.content, danmakuWeightRecord);
|
|
684
688
|
this.addUserToDanmakuMaker(body.user.uname, danmakuSenderRecord);
|
|
689
|
+
if (sub.customSpecialDanmakuUsers.enable && sub.customSpecialDanmakuUsers.specialDanmakuUsers?.includes(body.user.uid.toString())) {
|
|
690
|
+
const msgTemplate = sub.customSpecialDanmakuUsers.msgTemplate.replace("-mastername", masterInfo.username).replace("-uname", body.user.uname).replace("-msg", body.content);
|
|
691
|
+
const content = (0, koishi.h)("message", [koishi.h.text(msgTemplate)]);
|
|
692
|
+
this.ctx["bilibili-notify-push"].broadcastToTargets(sub.uid, content, PushType.UserDanmakuMsg);
|
|
693
|
+
}
|
|
685
694
|
},
|
|
686
695
|
onIncomeSuperChat: ({ body }) => {
|
|
687
696
|
this.segmentDanmaku(body.content, danmakuWeightRecord);
|
|
@@ -801,7 +810,19 @@ var BilibiliNotifyLive = class BilibiliNotifyLive extends koishi.Service {
|
|
|
801
810
|
await sendDanmakuWordCloudAndLiveSummary(sub.customLiveSummary.liveSummary);
|
|
802
811
|
}
|
|
803
812
|
}
|
|
804
|
-
}
|
|
813
|
+
};
|
|
814
|
+
const userAction = { onUserAction: ({ body }) => {
|
|
815
|
+
if (body.action === "enter" && sub.customSpecialUsersEnterTheRoom.specialUsersEnterTheRoom?.includes(body.user.toString())) {
|
|
816
|
+
const msgTemplate = sub.customSpecialUsersEnterTheRoom.msgTemplate.replace("-mastername", masterInfo.username).replace("-uname", body.user.uname);
|
|
817
|
+
const content = (0, koishi.h)("message", [koishi.h.text(msgTemplate)]);
|
|
818
|
+
this.ctx["bilibili-notify-push"].broadcastToTargets(sub.uid, content, PushType.UserActions);
|
|
819
|
+
}
|
|
820
|
+
} };
|
|
821
|
+
const finalMsgHandler = {
|
|
822
|
+
...handler,
|
|
823
|
+
...sub.customSpecialUsersEnterTheRoom.enable ? userAction : {}
|
|
824
|
+
};
|
|
825
|
+
await this.startLiveRoomListener(sub.roomid, finalMsgHandler);
|
|
805
826
|
if (!await useLiveRoomInfo(LiveType.FirstLiveBroadcast) && !await useMasterInfo(LiveType.FirstLiveBroadcast)) return this.ctx["bilibili-notify-push"].sendPrivateMsg("获取直播间信息失败,启动直播间弹幕检测失败");
|
|
806
827
|
this.logger.debug(`当前粉丝数:${masterInfo.liveOpenFollowerNum}`);
|
|
807
828
|
if (liveRoomInfo.live_status === 1) {
|
|
@@ -1201,9 +1222,9 @@ var BilibiliNotifySub = class extends koishi.Service {
|
|
|
1201
1222
|
const pushArrMap = /* @__PURE__ */ new Map();
|
|
1202
1223
|
for (const sub of Object.values(subs)) {
|
|
1203
1224
|
if (sub.customLiveMsg.enable) {
|
|
1204
|
-
if (sub.customLiveMsg.customLiveStart
|
|
1205
|
-
if (sub.customLiveMsg.customLiveEnd
|
|
1206
|
-
if (sub.customLiveMsg.customLive
|
|
1225
|
+
if (!sub.customLiveMsg.customLiveStart || !sub.customLiveMsg.customLiveStart.trim()) sub.customLiveMsg.customLiveStart = this.config.customLiveStart;
|
|
1226
|
+
if (!sub.customLiveMsg.customLiveEnd || !sub.customLiveMsg.customLiveEnd.trim()) sub.customLiveMsg.customLiveEnd = this.config.customLiveEnd;
|
|
1227
|
+
if (!sub.customLiveMsg.customLive || !sub.customLiveMsg.customLive.trim()) sub.customLiveMsg.customLive = this.config.customLive;
|
|
1207
1228
|
} else {
|
|
1208
1229
|
sub.customLiveMsg.enable = false;
|
|
1209
1230
|
sub.customLiveMsg.customLiveStart = this.config.customLiveStart;
|
|
@@ -1211,12 +1232,12 @@ var BilibiliNotifySub = class extends koishi.Service {
|
|
|
1211
1232
|
sub.customLiveMsg.customLive = this.config.customLive;
|
|
1212
1233
|
}
|
|
1213
1234
|
if (sub.customGuardBuy.enable) {
|
|
1214
|
-
if (sub.customGuardBuy.guardBuyMsg
|
|
1215
|
-
if (sub.customGuardBuy.captainImgUrl
|
|
1216
|
-
if (sub.customGuardBuy.supervisorImgUrl
|
|
1217
|
-
if (sub.customGuardBuy.governorImgUrl
|
|
1235
|
+
if (!sub.customGuardBuy.guardBuyMsg || !sub.customGuardBuy.guardBuyMsg.trim()) sub.customGuardBuy.guardBuyMsg = this.config.customGuardBuy.guardBuyMsg;
|
|
1236
|
+
if (!sub.customGuardBuy.captainImgUrl || !sub.customGuardBuy.captainImgUrl.trim()) sub.customGuardBuy.captainImgUrl = this.config.customGuardBuy.captainImgUrl;
|
|
1237
|
+
if (!sub.customGuardBuy.supervisorImgUrl || !sub.customGuardBuy.supervisorImgUrl.trim()) sub.customGuardBuy.supervisorImgUrl = this.config.customGuardBuy.supervisorImgUrl;
|
|
1238
|
+
if (!sub.customGuardBuy.governorImgUrl || !sub.customGuardBuy.governorImgUrl.trim()) sub.customGuardBuy.governorImgUrl = this.config.customGuardBuy.governorImgUrl;
|
|
1218
1239
|
} else if (this.config.customGuardBuy.enable) {
|
|
1219
|
-
sub.customGuardBuy.enable =
|
|
1240
|
+
sub.customGuardBuy.enable = false;
|
|
1220
1241
|
sub.customGuardBuy.guardBuyMsg = this.config.customGuardBuy.guardBuyMsg;
|
|
1221
1242
|
sub.customGuardBuy.captainImgUrl = this.config.customGuardBuy.captainImgUrl;
|
|
1222
1243
|
sub.customGuardBuy.supervisorImgUrl = this.config.customGuardBuy.supervisorImgUrl;
|
|
@@ -1236,18 +1257,22 @@ var BilibiliNotifySub = class extends koishi.Service {
|
|
|
1236
1257
|
const superchatArr = [];
|
|
1237
1258
|
const wordcloudArr = [];
|
|
1238
1259
|
const liveSummaryArr = [];
|
|
1260
|
+
const spacialDanmakuArr = [];
|
|
1261
|
+
const spacialUserEnterTheRoomArr = [];
|
|
1262
|
+
const conditions = [
|
|
1263
|
+
["dynamic", dynamicArr],
|
|
1264
|
+
["dynamicAtAll", dynamicAtAllArr],
|
|
1265
|
+
["live", liveArr],
|
|
1266
|
+
["liveAtAll", liveAtAllArr],
|
|
1267
|
+
["liveGuardBuy", liveGuardBuyArr],
|
|
1268
|
+
["superchat", superchatArr],
|
|
1269
|
+
["wordcloud", wordcloudArr],
|
|
1270
|
+
["liveSummary", liveSummaryArr],
|
|
1271
|
+
["spacialDanmaku", spacialDanmakuArr],
|
|
1272
|
+
["spacialUserEnterTheRoom", spacialUserEnterTheRoomArr]
|
|
1273
|
+
];
|
|
1239
1274
|
for (const platform of sub.target) for (const channel of platform.channelArr) {
|
|
1240
1275
|
const target = `${platform.platform}:${channel.channelId}`;
|
|
1241
|
-
const conditions = [
|
|
1242
|
-
["dynamic", dynamicArr],
|
|
1243
|
-
["dynamicAtAll", dynamicAtAllArr],
|
|
1244
|
-
["live", liveArr],
|
|
1245
|
-
["liveAtAll", liveAtAllArr],
|
|
1246
|
-
["liveGuardBuy", liveGuardBuyArr],
|
|
1247
|
-
["superchat", superchatArr],
|
|
1248
|
-
["wordcloud", wordcloudArr],
|
|
1249
|
-
["liveSummary", liveSummaryArr]
|
|
1250
|
-
];
|
|
1251
1276
|
for (const [key, arr] of conditions) if (channel[key]) arr.push(target);
|
|
1252
1277
|
}
|
|
1253
1278
|
pushArrMap.set(sub.uid, {
|
|
@@ -1258,7 +1283,9 @@ var BilibiliNotifySub = class extends koishi.Service {
|
|
|
1258
1283
|
liveSummaryArr,
|
|
1259
1284
|
liveGuardBuyArr,
|
|
1260
1285
|
superchatArr,
|
|
1261
|
-
wordcloudArr
|
|
1286
|
+
wordcloudArr,
|
|
1287
|
+
spacialDanmakuArr,
|
|
1288
|
+
spacialUserEnterTheRoomArr
|
|
1262
1289
|
});
|
|
1263
1290
|
}
|
|
1264
1291
|
this.ctx["bilibili-notify-push"].pushArrMap = pushArrMap;
|
|
@@ -1421,7 +1448,9 @@ var BilibiliNotifySub = class extends koishi.Service {
|
|
|
1421
1448
|
liveGuardBuy: s.liveGuardBuy,
|
|
1422
1449
|
superchat: s.superchat,
|
|
1423
1450
|
wordcloud: s.wordcloud,
|
|
1424
|
-
liveSummary: s.liveSummary
|
|
1451
|
+
liveSummary: s.liveSummary,
|
|
1452
|
+
spacialDanmaku: false,
|
|
1453
|
+
spacialUserEnterTheRoom: false
|
|
1425
1454
|
})),
|
|
1426
1455
|
platform: s.platform
|
|
1427
1456
|
}];
|
|
@@ -1437,7 +1466,9 @@ var BilibiliNotifySub = class extends koishi.Service {
|
|
|
1437
1466
|
customCardStyle: { enable: false },
|
|
1438
1467
|
customLiveMsg: { enable: false },
|
|
1439
1468
|
customLiveSummary: { enable: false },
|
|
1440
|
-
customGuardBuy: { enable: false }
|
|
1469
|
+
customGuardBuy: { enable: false },
|
|
1470
|
+
customSpecialDanmakuUsers: { enable: false },
|
|
1471
|
+
customSpecialUsersEnterTheRoom: { enable: false }
|
|
1441
1472
|
};
|
|
1442
1473
|
});
|
|
1443
1474
|
return subs;
|
|
@@ -1629,7 +1660,9 @@ var BilibiliNotifySub = class extends koishi.Service {
|
|
|
1629
1660
|
dynamic: sub.dynamic,
|
|
1630
1661
|
customCardStyle: sub.customCardStyle,
|
|
1631
1662
|
customLiveMsg: sub.customLiveMsg,
|
|
1632
|
-
customLiveSummary: sub.customLiveSummary
|
|
1663
|
+
customLiveSummary: sub.customLiveSummary,
|
|
1664
|
+
customSpecialDanmakuUsers: sub.customSpecialDanmakuUsers,
|
|
1665
|
+
customSpecialUsersEnterTheRoom: sub.customSpecialUsersEnterTheRoom
|
|
1633
1666
|
});
|
|
1634
1667
|
if (sub.live && !sub.roomid) {
|
|
1635
1668
|
this.logger.debug(`UID:${sub.uid} 请求了用户接口`);
|
|
@@ -1826,14 +1859,14 @@ var BilibiliNotifyPush = class extends koishi.Service {
|
|
|
1826
1859
|
}
|
|
1827
1860
|
const record = this.pushArrMap.get(uid);
|
|
1828
1861
|
if (!record) return;
|
|
1829
|
-
if (!(type === PushType.StartBroadcasting && record.liveAtAllArr?.length > 0 || type === PushType.Dynamic && (record.dynamicArr?.length > 0 || record.dynamicAtAllArr?.length > 0) || (type === PushType.Live || type === PushType.StartBroadcasting) && record.liveArr?.length > 0 || type === PushType.LiveGuardBuy && record.liveGuardBuyArr?.length > 0 || type === PushType.Superchat && record.superchatArr?.length > 0 || type === PushType.WordCloudAndLiveSummary && (record.wordcloudArr?.length > 0 || record.liveSummaryArr?.length > 0))) return;
|
|
1862
|
+
if (!(type === PushType.StartBroadcasting && record.liveAtAllArr?.length > 0 || type === PushType.Dynamic && (record.dynamicArr?.length > 0 || record.dynamicAtAllArr?.length > 0) || (type === PushType.Live || type === PushType.StartBroadcasting) && record.liveArr?.length > 0 || type === PushType.LiveGuardBuy && record.liveGuardBuyArr?.length > 0 || type === PushType.Superchat && record.superchatArr?.length > 0 || type === PushType.WordCloudAndLiveSummary && (record.wordcloudArr?.length > 0 || record.liveSummaryArr?.length > 0) || type === PushType.UserDanmakuMsg && record.spacialDanmakuArr?.length > 0 || type === PushType.UserActions && record.spacialUserEnterTheRoomArr?.length > 0)) return;
|
|
1830
1863
|
this.logger.info(`推送对象: ${uid}, 推送类型: ${PushTypeMsg[type]}`);
|
|
1831
|
-
if (type === PushType.StartBroadcasting
|
|
1864
|
+
if (type === PushType.StartBroadcasting) {
|
|
1832
1865
|
this.logger.debug(`推送给 @全体,对象列表:${record.liveAtAllArr}`);
|
|
1833
1866
|
const atAllArr = structuredClone(record.liveAtAllArr);
|
|
1834
1867
|
await withRetry(() => this.pushMessage(atAllArr, koishi.h.at("all")), 1);
|
|
1835
1868
|
}
|
|
1836
|
-
if (type === PushType.Dynamic
|
|
1869
|
+
if (type === PushType.Dynamic) {
|
|
1837
1870
|
if (record.dynamicAtAllArr?.length > 0) {
|
|
1838
1871
|
this.logger.debug(`推送动态给 @全体,对象列表:${record.dynamicAtAllArr}`);
|
|
1839
1872
|
const dynamicAtAllArr = structuredClone(record.dynamicAtAllArr);
|
|
@@ -1843,17 +1876,17 @@ var BilibiliNotifyPush = class extends koishi.Service {
|
|
|
1843
1876
|
const dynamicArr = structuredClone(record.dynamicArr);
|
|
1844
1877
|
await withRetry(() => this.pushMessage(dynamicArr, (0, koishi.h)("message", content)), 1);
|
|
1845
1878
|
}
|
|
1846
|
-
if (
|
|
1879
|
+
if (type === PushType.Live || type === PushType.StartBroadcasting) {
|
|
1847
1880
|
this.logger.debug(`推送直播,对象列表:${record.liveArr}`);
|
|
1848
1881
|
const liveArr = structuredClone(record.liveArr);
|
|
1849
1882
|
await withRetry(() => this.pushMessage(liveArr, (0, koishi.h)("message", content)), 1);
|
|
1850
1883
|
}
|
|
1851
|
-
if (type === PushType.LiveGuardBuy
|
|
1884
|
+
if (type === PushType.LiveGuardBuy) {
|
|
1852
1885
|
this.logger.debug(`推送直播守护购买消息,对象列表:${record.liveGuardBuyArr}`);
|
|
1853
1886
|
const liveGuardBuyArr = structuredClone(record.liveGuardBuyArr);
|
|
1854
1887
|
await withRetry(() => this.pushMessage(liveGuardBuyArr, (0, koishi.h)("message", content)), 1);
|
|
1855
1888
|
}
|
|
1856
|
-
if (type === PushType.Superchat
|
|
1889
|
+
if (type === PushType.Superchat) {
|
|
1857
1890
|
this.logger.debug(`推送 SC 消息,对象列表:${record.superchatArr}`);
|
|
1858
1891
|
const superchatArr = structuredClone(record.superchatArr);
|
|
1859
1892
|
await withRetry(() => this.pushMessage(superchatArr, (0, koishi.h)("message", content)), 1);
|
|
@@ -1878,6 +1911,16 @@ var BilibiliNotifyPush = class extends koishi.Service {
|
|
|
1878
1911
|
await withRetry(() => this.pushMessage(liveSummaryOnlyArr, (0, koishi.h)("message", content[1])), 1);
|
|
1879
1912
|
}
|
|
1880
1913
|
}
|
|
1914
|
+
if (type === PushType.UserDanmakuMsg) {
|
|
1915
|
+
this.logger.debug(`推送用户弹幕消息,对象列表:${record.spacialDanmakuArr}`);
|
|
1916
|
+
const spacialDanmakuArr = structuredClone(record.spacialDanmakuArr);
|
|
1917
|
+
await withRetry(() => this.pushMessage(spacialDanmakuArr, (0, koishi.h)("message", content)), 1);
|
|
1918
|
+
}
|
|
1919
|
+
if (type === PushType.UserActions) {
|
|
1920
|
+
this.logger.debug(`推送用户进入直播间消息,对象列表:${record.spacialUserEnterTheRoomArr}`);
|
|
1921
|
+
const spacialUserEnterTheRoomArr = structuredClone(record.spacialUserEnterTheRoomArr);
|
|
1922
|
+
await withRetry(() => this.pushMessage(spacialUserEnterTheRoomArr, (0, koishi.h)("message", content)), 1);
|
|
1923
|
+
}
|
|
1881
1924
|
}
|
|
1882
1925
|
};
|
|
1883
1926
|
(function(_BilibiliNotifyPush) {
|
package/lib/index.d.cts
CHANGED
|
@@ -76,6 +76,8 @@ type Channel = {
|
|
|
76
76
|
superchat: boolean;
|
|
77
77
|
wordcloud: boolean;
|
|
78
78
|
liveSummary: boolean;
|
|
79
|
+
spacialDanmaku: boolean;
|
|
80
|
+
spacialUserEnterTheRoom: boolean;
|
|
79
81
|
};
|
|
80
82
|
type ChannelArr = Array<Channel>;
|
|
81
83
|
type TargetItem = {
|
|
@@ -107,6 +109,16 @@ type CustomLiveSummary = {
|
|
|
107
109
|
enable: boolean;
|
|
108
110
|
liveSummary?: Array<string> | string;
|
|
109
111
|
};
|
|
112
|
+
type CustomSpecialDanmakuUsers = {
|
|
113
|
+
enable: boolean;
|
|
114
|
+
specialDanmakuUsers?: Array<string>;
|
|
115
|
+
msgTemplate?: string;
|
|
116
|
+
};
|
|
117
|
+
type CustomSpecialUsersEnterTheRoom = {
|
|
118
|
+
enable: boolean;
|
|
119
|
+
specialUsersEnterTheRoom?: Array<string>;
|
|
120
|
+
msgTemplate?: string;
|
|
121
|
+
};
|
|
110
122
|
type Subscription = {
|
|
111
123
|
uname: string;
|
|
112
124
|
uid: string;
|
|
@@ -119,6 +131,8 @@ type Subscription = {
|
|
|
119
131
|
customLiveMsg: CustomLiveMsg;
|
|
120
132
|
customLiveSummary: CustomLiveSummary;
|
|
121
133
|
customGuardBuy: CustomGuardBuy;
|
|
134
|
+
customSpecialDanmakuUsers: CustomSpecialDanmakuUsers;
|
|
135
|
+
customSpecialUsersEnterTheRoom: CustomSpecialUsersEnterTheRoom;
|
|
122
136
|
};
|
|
123
137
|
type Subscriptions = Record<string, Subscription>;
|
|
124
138
|
declare enum BiliLoginStatus {
|
package/lib/index.d.mts
CHANGED
|
@@ -76,6 +76,8 @@ type Channel = {
|
|
|
76
76
|
superchat: boolean;
|
|
77
77
|
wordcloud: boolean;
|
|
78
78
|
liveSummary: boolean;
|
|
79
|
+
spacialDanmaku: boolean;
|
|
80
|
+
spacialUserEnterTheRoom: boolean;
|
|
79
81
|
};
|
|
80
82
|
type ChannelArr = Array<Channel>;
|
|
81
83
|
type TargetItem = {
|
|
@@ -107,6 +109,16 @@ type CustomLiveSummary = {
|
|
|
107
109
|
enable: boolean;
|
|
108
110
|
liveSummary?: Array<string> | string;
|
|
109
111
|
};
|
|
112
|
+
type CustomSpecialDanmakuUsers = {
|
|
113
|
+
enable: boolean;
|
|
114
|
+
specialDanmakuUsers?: Array<string>;
|
|
115
|
+
msgTemplate?: string;
|
|
116
|
+
};
|
|
117
|
+
type CustomSpecialUsersEnterTheRoom = {
|
|
118
|
+
enable: boolean;
|
|
119
|
+
specialUsersEnterTheRoom?: Array<string>;
|
|
120
|
+
msgTemplate?: string;
|
|
121
|
+
};
|
|
110
122
|
type Subscription = {
|
|
111
123
|
uname: string;
|
|
112
124
|
uid: string;
|
|
@@ -119,6 +131,8 @@ type Subscription = {
|
|
|
119
131
|
customLiveMsg: CustomLiveMsg;
|
|
120
132
|
customLiveSummary: CustomLiveSummary;
|
|
121
133
|
customGuardBuy: CustomGuardBuy;
|
|
134
|
+
customSpecialDanmakuUsers: CustomSpecialDanmakuUsers;
|
|
135
|
+
customSpecialUsersEnterTheRoom: CustomSpecialUsersEnterTheRoom;
|
|
122
136
|
};
|
|
123
137
|
type Subscriptions = Record<string, Subscription>;
|
|
124
138
|
declare enum BiliLoginStatus {
|
package/lib/index.mjs
CHANGED
|
@@ -153,6 +153,8 @@ let PushType = /* @__PURE__ */ function(PushType$1) {
|
|
|
153
153
|
PushType$1[PushType$1["LiveGuardBuy"] = 4] = "LiveGuardBuy";
|
|
154
154
|
PushType$1[PushType$1["WordCloudAndLiveSummary"] = 5] = "WordCloudAndLiveSummary";
|
|
155
155
|
PushType$1[PushType$1["Superchat"] = 6] = "Superchat";
|
|
156
|
+
PushType$1[PushType$1["UserDanmakuMsg"] = 7] = "UserDanmakuMsg";
|
|
157
|
+
PushType$1[PushType$1["UserActions"] = 8] = "UserActions";
|
|
156
158
|
return PushType$1;
|
|
157
159
|
}({});
|
|
158
160
|
const PushTypeMsg = {
|
|
@@ -162,7 +164,9 @@ const PushTypeMsg = {
|
|
|
162
164
|
[PushType.StartBroadcasting]: "开播推送",
|
|
163
165
|
[PushType.LiveGuardBuy]: "上舰推送",
|
|
164
166
|
[PushType.WordCloudAndLiveSummary]: "弹幕词云和直播总结推送",
|
|
165
|
-
[PushType.Superchat]: "SC推送"
|
|
167
|
+
[PushType.Superchat]: "SC推送",
|
|
168
|
+
[PushType.UserDanmakuMsg]: "用户弹幕推送",
|
|
169
|
+
[PushType.UserActions]: "用户行为推送"
|
|
166
170
|
};
|
|
167
171
|
let BiliLoginStatus = /* @__PURE__ */ function(BiliLoginStatus$1) {
|
|
168
172
|
BiliLoginStatus$1[BiliLoginStatus$1["NOT_LOGIN"] = 0] = "NOT_LOGIN";
|
|
@@ -641,7 +645,7 @@ var BilibiliNotifyLive = class BilibiliNotifyLive extends Service {
|
|
|
641
645
|
const LIVE_EVENT_COOLDOWN = 10 * 1e3;
|
|
642
646
|
let lastLiveStart = 0;
|
|
643
647
|
let lastLiveEnd = 0;
|
|
644
|
-
|
|
648
|
+
const handler = {
|
|
645
649
|
onError: async () => {
|
|
646
650
|
liveStatus = false;
|
|
647
651
|
pushAtTimeTimer?.();
|
|
@@ -653,6 +657,11 @@ var BilibiliNotifyLive = class BilibiliNotifyLive extends Service {
|
|
|
653
657
|
onIncomeDanmu: ({ body }) => {
|
|
654
658
|
this.segmentDanmaku(body.content, danmakuWeightRecord);
|
|
655
659
|
this.addUserToDanmakuMaker(body.user.uname, danmakuSenderRecord);
|
|
660
|
+
if (sub.customSpecialDanmakuUsers.enable && sub.customSpecialDanmakuUsers.specialDanmakuUsers?.includes(body.user.uid.toString())) {
|
|
661
|
+
const msgTemplate = sub.customSpecialDanmakuUsers.msgTemplate.replace("-mastername", masterInfo.username).replace("-uname", body.user.uname).replace("-msg", body.content);
|
|
662
|
+
const content = h("message", [h.text(msgTemplate)]);
|
|
663
|
+
this.ctx["bilibili-notify-push"].broadcastToTargets(sub.uid, content, PushType.UserDanmakuMsg);
|
|
664
|
+
}
|
|
656
665
|
},
|
|
657
666
|
onIncomeSuperChat: ({ body }) => {
|
|
658
667
|
this.segmentDanmaku(body.content, danmakuWeightRecord);
|
|
@@ -772,7 +781,19 @@ var BilibiliNotifyLive = class BilibiliNotifyLive extends Service {
|
|
|
772
781
|
await sendDanmakuWordCloudAndLiveSummary(sub.customLiveSummary.liveSummary);
|
|
773
782
|
}
|
|
774
783
|
}
|
|
775
|
-
}
|
|
784
|
+
};
|
|
785
|
+
const userAction = { onUserAction: ({ body }) => {
|
|
786
|
+
if (body.action === "enter" && sub.customSpecialUsersEnterTheRoom.specialUsersEnterTheRoom?.includes(body.user.toString())) {
|
|
787
|
+
const msgTemplate = sub.customSpecialUsersEnterTheRoom.msgTemplate.replace("-mastername", masterInfo.username).replace("-uname", body.user.uname);
|
|
788
|
+
const content = h("message", [h.text(msgTemplate)]);
|
|
789
|
+
this.ctx["bilibili-notify-push"].broadcastToTargets(sub.uid, content, PushType.UserActions);
|
|
790
|
+
}
|
|
791
|
+
} };
|
|
792
|
+
const finalMsgHandler = {
|
|
793
|
+
...handler,
|
|
794
|
+
...sub.customSpecialUsersEnterTheRoom.enable ? userAction : {}
|
|
795
|
+
};
|
|
796
|
+
await this.startLiveRoomListener(sub.roomid, finalMsgHandler);
|
|
776
797
|
if (!await useLiveRoomInfo(LiveType.FirstLiveBroadcast) && !await useMasterInfo(LiveType.FirstLiveBroadcast)) return this.ctx["bilibili-notify-push"].sendPrivateMsg("获取直播间信息失败,启动直播间弹幕检测失败");
|
|
777
798
|
this.logger.debug(`当前粉丝数:${masterInfo.liveOpenFollowerNum}`);
|
|
778
799
|
if (liveRoomInfo.live_status === 1) {
|
|
@@ -1172,9 +1193,9 @@ var BilibiliNotifySub = class extends Service {
|
|
|
1172
1193
|
const pushArrMap = /* @__PURE__ */ new Map();
|
|
1173
1194
|
for (const sub of Object.values(subs)) {
|
|
1174
1195
|
if (sub.customLiveMsg.enable) {
|
|
1175
|
-
if (sub.customLiveMsg.customLiveStart
|
|
1176
|
-
if (sub.customLiveMsg.customLiveEnd
|
|
1177
|
-
if (sub.customLiveMsg.customLive
|
|
1196
|
+
if (!sub.customLiveMsg.customLiveStart || !sub.customLiveMsg.customLiveStart.trim()) sub.customLiveMsg.customLiveStart = this.config.customLiveStart;
|
|
1197
|
+
if (!sub.customLiveMsg.customLiveEnd || !sub.customLiveMsg.customLiveEnd.trim()) sub.customLiveMsg.customLiveEnd = this.config.customLiveEnd;
|
|
1198
|
+
if (!sub.customLiveMsg.customLive || !sub.customLiveMsg.customLive.trim()) sub.customLiveMsg.customLive = this.config.customLive;
|
|
1178
1199
|
} else {
|
|
1179
1200
|
sub.customLiveMsg.enable = false;
|
|
1180
1201
|
sub.customLiveMsg.customLiveStart = this.config.customLiveStart;
|
|
@@ -1182,12 +1203,12 @@ var BilibiliNotifySub = class extends Service {
|
|
|
1182
1203
|
sub.customLiveMsg.customLive = this.config.customLive;
|
|
1183
1204
|
}
|
|
1184
1205
|
if (sub.customGuardBuy.enable) {
|
|
1185
|
-
if (sub.customGuardBuy.guardBuyMsg
|
|
1186
|
-
if (sub.customGuardBuy.captainImgUrl
|
|
1187
|
-
if (sub.customGuardBuy.supervisorImgUrl
|
|
1188
|
-
if (sub.customGuardBuy.governorImgUrl
|
|
1206
|
+
if (!sub.customGuardBuy.guardBuyMsg || !sub.customGuardBuy.guardBuyMsg.trim()) sub.customGuardBuy.guardBuyMsg = this.config.customGuardBuy.guardBuyMsg;
|
|
1207
|
+
if (!sub.customGuardBuy.captainImgUrl || !sub.customGuardBuy.captainImgUrl.trim()) sub.customGuardBuy.captainImgUrl = this.config.customGuardBuy.captainImgUrl;
|
|
1208
|
+
if (!sub.customGuardBuy.supervisorImgUrl || !sub.customGuardBuy.supervisorImgUrl.trim()) sub.customGuardBuy.supervisorImgUrl = this.config.customGuardBuy.supervisorImgUrl;
|
|
1209
|
+
if (!sub.customGuardBuy.governorImgUrl || !sub.customGuardBuy.governorImgUrl.trim()) sub.customGuardBuy.governorImgUrl = this.config.customGuardBuy.governorImgUrl;
|
|
1189
1210
|
} else if (this.config.customGuardBuy.enable) {
|
|
1190
|
-
sub.customGuardBuy.enable =
|
|
1211
|
+
sub.customGuardBuy.enable = false;
|
|
1191
1212
|
sub.customGuardBuy.guardBuyMsg = this.config.customGuardBuy.guardBuyMsg;
|
|
1192
1213
|
sub.customGuardBuy.captainImgUrl = this.config.customGuardBuy.captainImgUrl;
|
|
1193
1214
|
sub.customGuardBuy.supervisorImgUrl = this.config.customGuardBuy.supervisorImgUrl;
|
|
@@ -1207,18 +1228,22 @@ var BilibiliNotifySub = class extends Service {
|
|
|
1207
1228
|
const superchatArr = [];
|
|
1208
1229
|
const wordcloudArr = [];
|
|
1209
1230
|
const liveSummaryArr = [];
|
|
1231
|
+
const spacialDanmakuArr = [];
|
|
1232
|
+
const spacialUserEnterTheRoomArr = [];
|
|
1233
|
+
const conditions = [
|
|
1234
|
+
["dynamic", dynamicArr],
|
|
1235
|
+
["dynamicAtAll", dynamicAtAllArr],
|
|
1236
|
+
["live", liveArr],
|
|
1237
|
+
["liveAtAll", liveAtAllArr],
|
|
1238
|
+
["liveGuardBuy", liveGuardBuyArr],
|
|
1239
|
+
["superchat", superchatArr],
|
|
1240
|
+
["wordcloud", wordcloudArr],
|
|
1241
|
+
["liveSummary", liveSummaryArr],
|
|
1242
|
+
["spacialDanmaku", spacialDanmakuArr],
|
|
1243
|
+
["spacialUserEnterTheRoom", spacialUserEnterTheRoomArr]
|
|
1244
|
+
];
|
|
1210
1245
|
for (const platform of sub.target) for (const channel of platform.channelArr) {
|
|
1211
1246
|
const target = `${platform.platform}:${channel.channelId}`;
|
|
1212
|
-
const conditions = [
|
|
1213
|
-
["dynamic", dynamicArr],
|
|
1214
|
-
["dynamicAtAll", dynamicAtAllArr],
|
|
1215
|
-
["live", liveArr],
|
|
1216
|
-
["liveAtAll", liveAtAllArr],
|
|
1217
|
-
["liveGuardBuy", liveGuardBuyArr],
|
|
1218
|
-
["superchat", superchatArr],
|
|
1219
|
-
["wordcloud", wordcloudArr],
|
|
1220
|
-
["liveSummary", liveSummaryArr]
|
|
1221
|
-
];
|
|
1222
1247
|
for (const [key, arr] of conditions) if (channel[key]) arr.push(target);
|
|
1223
1248
|
}
|
|
1224
1249
|
pushArrMap.set(sub.uid, {
|
|
@@ -1229,7 +1254,9 @@ var BilibiliNotifySub = class extends Service {
|
|
|
1229
1254
|
liveSummaryArr,
|
|
1230
1255
|
liveGuardBuyArr,
|
|
1231
1256
|
superchatArr,
|
|
1232
|
-
wordcloudArr
|
|
1257
|
+
wordcloudArr,
|
|
1258
|
+
spacialDanmakuArr,
|
|
1259
|
+
spacialUserEnterTheRoomArr
|
|
1233
1260
|
});
|
|
1234
1261
|
}
|
|
1235
1262
|
this.ctx["bilibili-notify-push"].pushArrMap = pushArrMap;
|
|
@@ -1392,7 +1419,9 @@ var BilibiliNotifySub = class extends Service {
|
|
|
1392
1419
|
liveGuardBuy: s.liveGuardBuy,
|
|
1393
1420
|
superchat: s.superchat,
|
|
1394
1421
|
wordcloud: s.wordcloud,
|
|
1395
|
-
liveSummary: s.liveSummary
|
|
1422
|
+
liveSummary: s.liveSummary,
|
|
1423
|
+
spacialDanmaku: false,
|
|
1424
|
+
spacialUserEnterTheRoom: false
|
|
1396
1425
|
})),
|
|
1397
1426
|
platform: s.platform
|
|
1398
1427
|
}];
|
|
@@ -1408,7 +1437,9 @@ var BilibiliNotifySub = class extends Service {
|
|
|
1408
1437
|
customCardStyle: { enable: false },
|
|
1409
1438
|
customLiveMsg: { enable: false },
|
|
1410
1439
|
customLiveSummary: { enable: false },
|
|
1411
|
-
customGuardBuy: { enable: false }
|
|
1440
|
+
customGuardBuy: { enable: false },
|
|
1441
|
+
customSpecialDanmakuUsers: { enable: false },
|
|
1442
|
+
customSpecialUsersEnterTheRoom: { enable: false }
|
|
1412
1443
|
};
|
|
1413
1444
|
});
|
|
1414
1445
|
return subs;
|
|
@@ -1600,7 +1631,9 @@ var BilibiliNotifySub = class extends Service {
|
|
|
1600
1631
|
dynamic: sub.dynamic,
|
|
1601
1632
|
customCardStyle: sub.customCardStyle,
|
|
1602
1633
|
customLiveMsg: sub.customLiveMsg,
|
|
1603
|
-
customLiveSummary: sub.customLiveSummary
|
|
1634
|
+
customLiveSummary: sub.customLiveSummary,
|
|
1635
|
+
customSpecialDanmakuUsers: sub.customSpecialDanmakuUsers,
|
|
1636
|
+
customSpecialUsersEnterTheRoom: sub.customSpecialUsersEnterTheRoom
|
|
1604
1637
|
});
|
|
1605
1638
|
if (sub.live && !sub.roomid) {
|
|
1606
1639
|
this.logger.debug(`UID:${sub.uid} 请求了用户接口`);
|
|
@@ -1797,14 +1830,14 @@ var BilibiliNotifyPush = class extends Service {
|
|
|
1797
1830
|
}
|
|
1798
1831
|
const record = this.pushArrMap.get(uid);
|
|
1799
1832
|
if (!record) return;
|
|
1800
|
-
if (!(type === PushType.StartBroadcasting && record.liveAtAllArr?.length > 0 || type === PushType.Dynamic && (record.dynamicArr?.length > 0 || record.dynamicAtAllArr?.length > 0) || (type === PushType.Live || type === PushType.StartBroadcasting) && record.liveArr?.length > 0 || type === PushType.LiveGuardBuy && record.liveGuardBuyArr?.length > 0 || type === PushType.Superchat && record.superchatArr?.length > 0 || type === PushType.WordCloudAndLiveSummary && (record.wordcloudArr?.length > 0 || record.liveSummaryArr?.length > 0))) return;
|
|
1833
|
+
if (!(type === PushType.StartBroadcasting && record.liveAtAllArr?.length > 0 || type === PushType.Dynamic && (record.dynamicArr?.length > 0 || record.dynamicAtAllArr?.length > 0) || (type === PushType.Live || type === PushType.StartBroadcasting) && record.liveArr?.length > 0 || type === PushType.LiveGuardBuy && record.liveGuardBuyArr?.length > 0 || type === PushType.Superchat && record.superchatArr?.length > 0 || type === PushType.WordCloudAndLiveSummary && (record.wordcloudArr?.length > 0 || record.liveSummaryArr?.length > 0) || type === PushType.UserDanmakuMsg && record.spacialDanmakuArr?.length > 0 || type === PushType.UserActions && record.spacialUserEnterTheRoomArr?.length > 0)) return;
|
|
1801
1834
|
this.logger.info(`推送对象: ${uid}, 推送类型: ${PushTypeMsg[type]}`);
|
|
1802
|
-
if (type === PushType.StartBroadcasting
|
|
1835
|
+
if (type === PushType.StartBroadcasting) {
|
|
1803
1836
|
this.logger.debug(`推送给 @全体,对象列表:${record.liveAtAllArr}`);
|
|
1804
1837
|
const atAllArr = structuredClone(record.liveAtAllArr);
|
|
1805
1838
|
await withRetry(() => this.pushMessage(atAllArr, h.at("all")), 1);
|
|
1806
1839
|
}
|
|
1807
|
-
if (type === PushType.Dynamic
|
|
1840
|
+
if (type === PushType.Dynamic) {
|
|
1808
1841
|
if (record.dynamicAtAllArr?.length > 0) {
|
|
1809
1842
|
this.logger.debug(`推送动态给 @全体,对象列表:${record.dynamicAtAllArr}`);
|
|
1810
1843
|
const dynamicAtAllArr = structuredClone(record.dynamicAtAllArr);
|
|
@@ -1814,17 +1847,17 @@ var BilibiliNotifyPush = class extends Service {
|
|
|
1814
1847
|
const dynamicArr = structuredClone(record.dynamicArr);
|
|
1815
1848
|
await withRetry(() => this.pushMessage(dynamicArr, h("message", content)), 1);
|
|
1816
1849
|
}
|
|
1817
|
-
if (
|
|
1850
|
+
if (type === PushType.Live || type === PushType.StartBroadcasting) {
|
|
1818
1851
|
this.logger.debug(`推送直播,对象列表:${record.liveArr}`);
|
|
1819
1852
|
const liveArr = structuredClone(record.liveArr);
|
|
1820
1853
|
await withRetry(() => this.pushMessage(liveArr, h("message", content)), 1);
|
|
1821
1854
|
}
|
|
1822
|
-
if (type === PushType.LiveGuardBuy
|
|
1855
|
+
if (type === PushType.LiveGuardBuy) {
|
|
1823
1856
|
this.logger.debug(`推送直播守护购买消息,对象列表:${record.liveGuardBuyArr}`);
|
|
1824
1857
|
const liveGuardBuyArr = structuredClone(record.liveGuardBuyArr);
|
|
1825
1858
|
await withRetry(() => this.pushMessage(liveGuardBuyArr, h("message", content)), 1);
|
|
1826
1859
|
}
|
|
1827
|
-
if (type === PushType.Superchat
|
|
1860
|
+
if (type === PushType.Superchat) {
|
|
1828
1861
|
this.logger.debug(`推送 SC 消息,对象列表:${record.superchatArr}`);
|
|
1829
1862
|
const superchatArr = structuredClone(record.superchatArr);
|
|
1830
1863
|
await withRetry(() => this.pushMessage(superchatArr, h("message", content)), 1);
|
|
@@ -1849,6 +1882,16 @@ var BilibiliNotifyPush = class extends Service {
|
|
|
1849
1882
|
await withRetry(() => this.pushMessage(liveSummaryOnlyArr, h("message", content[1])), 1);
|
|
1850
1883
|
}
|
|
1851
1884
|
}
|
|
1885
|
+
if (type === PushType.UserDanmakuMsg) {
|
|
1886
|
+
this.logger.debug(`推送用户弹幕消息,对象列表:${record.spacialDanmakuArr}`);
|
|
1887
|
+
const spacialDanmakuArr = structuredClone(record.spacialDanmakuArr);
|
|
1888
|
+
await withRetry(() => this.pushMessage(spacialDanmakuArr, h("message", content)), 1);
|
|
1889
|
+
}
|
|
1890
|
+
if (type === PushType.UserActions) {
|
|
1891
|
+
this.logger.debug(`推送用户进入直播间消息,对象列表:${record.spacialUserEnterTheRoomArr}`);
|
|
1892
|
+
const spacialUserEnterTheRoomArr = structuredClone(record.spacialUserEnterTheRoomArr);
|
|
1893
|
+
await withRetry(() => this.pushMessage(spacialUserEnterTheRoomArr, h("message", content)), 1);
|
|
1894
|
+
}
|
|
1852
1895
|
}
|
|
1853
1896
|
};
|
|
1854
1897
|
(function(_BilibiliNotifyPush) {
|