koishi-plugin-bilibili-notify 3.7.2 → 3.8.0-alpha.0

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 CHANGED
@@ -1 +1 @@
1
- import{defineComponent as F,inject as T,ref as c,watch as D,resolveComponent as S,createElementBlock as o,openBlock as i,Fragment as N,createCommentVNode as u,createBlock as f,createElementVNode as e,toDisplayString as a,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};
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
- await this.startLiveRoomListener(sub.roomid, {
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) {
@@ -1236,6 +1257,8 @@ var BilibiliNotifySub = class extends koishi.Service {
1236
1257
  const superchatArr = [];
1237
1258
  const wordcloudArr = [];
1238
1259
  const liveSummaryArr = [];
1260
+ const spacialDanmakuArr = [];
1261
+ const spacialUserEnterTheRoomArr = [];
1239
1262
  for (const platform of sub.target) for (const channel of platform.channelArr) {
1240
1263
  const target = `${platform.platform}:${channel.channelId}`;
1241
1264
  const conditions = [
@@ -1246,7 +1269,9 @@ var BilibiliNotifySub = class extends koishi.Service {
1246
1269
  ["liveGuardBuy", liveGuardBuyArr],
1247
1270
  ["superchat", superchatArr],
1248
1271
  ["wordcloud", wordcloudArr],
1249
- ["liveSummary", liveSummaryArr]
1272
+ ["liveSummary", liveSummaryArr],
1273
+ ["spacialDanmaku", spacialDanmakuArr],
1274
+ ["spacialUserEnterTheRoom", spacialUserEnterTheRoomArr]
1250
1275
  ];
1251
1276
  for (const [key, arr] of conditions) if (channel[key]) arr.push(target);
1252
1277
  }
@@ -1421,7 +1446,9 @@ var BilibiliNotifySub = class extends koishi.Service {
1421
1446
  liveGuardBuy: s.liveGuardBuy,
1422
1447
  superchat: s.superchat,
1423
1448
  wordcloud: s.wordcloud,
1424
- liveSummary: s.liveSummary
1449
+ liveSummary: s.liveSummary,
1450
+ spacialDanmaku: false,
1451
+ spacialUserEnterTheRoom: false
1425
1452
  })),
1426
1453
  platform: s.platform
1427
1454
  }];
@@ -1437,7 +1464,9 @@ var BilibiliNotifySub = class extends koishi.Service {
1437
1464
  customCardStyle: { enable: false },
1438
1465
  customLiveMsg: { enable: false },
1439
1466
  customLiveSummary: { enable: false },
1440
- customGuardBuy: { enable: false }
1467
+ customGuardBuy: { enable: false },
1468
+ customSpecialDanmakuUsers: { enable: false },
1469
+ customSpecialUsersEnterTheRoom: { enable: false }
1441
1470
  };
1442
1471
  });
1443
1472
  return subs;
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
- await this.startLiveRoomListener(sub.roomid, {
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) {
@@ -1207,6 +1228,8 @@ var BilibiliNotifySub = class extends Service {
1207
1228
  const superchatArr = [];
1208
1229
  const wordcloudArr = [];
1209
1230
  const liveSummaryArr = [];
1231
+ const spacialDanmakuArr = [];
1232
+ const spacialUserEnterTheRoomArr = [];
1210
1233
  for (const platform of sub.target) for (const channel of platform.channelArr) {
1211
1234
  const target = `${platform.platform}:${channel.channelId}`;
1212
1235
  const conditions = [
@@ -1217,7 +1240,9 @@ var BilibiliNotifySub = class extends Service {
1217
1240
  ["liveGuardBuy", liveGuardBuyArr],
1218
1241
  ["superchat", superchatArr],
1219
1242
  ["wordcloud", wordcloudArr],
1220
- ["liveSummary", liveSummaryArr]
1243
+ ["liveSummary", liveSummaryArr],
1244
+ ["spacialDanmaku", spacialDanmakuArr],
1245
+ ["spacialUserEnterTheRoom", spacialUserEnterTheRoomArr]
1221
1246
  ];
1222
1247
  for (const [key, arr] of conditions) if (channel[key]) arr.push(target);
1223
1248
  }
@@ -1392,7 +1417,9 @@ var BilibiliNotifySub = class extends Service {
1392
1417
  liveGuardBuy: s.liveGuardBuy,
1393
1418
  superchat: s.superchat,
1394
1419
  wordcloud: s.wordcloud,
1395
- liveSummary: s.liveSummary
1420
+ liveSummary: s.liveSummary,
1421
+ spacialDanmaku: false,
1422
+ spacialUserEnterTheRoom: false
1396
1423
  })),
1397
1424
  platform: s.platform
1398
1425
  }];
@@ -1408,7 +1435,9 @@ var BilibiliNotifySub = class extends Service {
1408
1435
  customCardStyle: { enable: false },
1409
1436
  customLiveMsg: { enable: false },
1410
1437
  customLiveSummary: { enable: false },
1411
- customGuardBuy: { enable: false }
1438
+ customGuardBuy: { enable: false },
1439
+ customSpecialDanmakuUsers: { enable: false },
1440
+ customSpecialUsersEnterTheRoom: { enable: false }
1412
1441
  };
1413
1442
  });
1414
1443
  return subs;
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.7.2",
4
+ "version": "3.8.0-alpha.0",
5
5
  "main": "./lib/index.cjs",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [