From fff4f4b8ec1dd8c9b9d5e7ee1446ab6d02c631d7 Mon Sep 17 00:00:00 2001 From: ricardo Date: Sun, 16 Apr 2023 08:01:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=89=8D=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nonebot_plugin_blive_danmaku/__init__.py | 1 - .../app/frontend/assets/index-123dda7d.js | 1 - .../app/frontend/assets/index-1ac547dd.js | 1 + .../app/frontend/assets/index-69687512.js | 1 + .../app/frontend/assets/index-89088ace.js | 1 + .../app/frontend/assets/index-9a172246.css | 1 + .../app/frontend/assets/index-a662ddb2.css | 1 - .../app/frontend/assets/index-e1716a6f.js | 1 - .../app/frontend/assets/index-e2ab3243.js | 1 - .../app/frontend/index.html | 2 +- .../command/subscribe/danmaku.py | 23 ++++++++++++++++++- .../command/subscribe/live.py | 5 ++-- pyproject.toml | 2 +- 13 files changed, 30 insertions(+), 11 deletions(-) delete mode 100644 nonebot_plugin_blive_danmaku/app/frontend/assets/index-123dda7d.js create mode 100644 nonebot_plugin_blive_danmaku/app/frontend/assets/index-1ac547dd.js create mode 100644 nonebot_plugin_blive_danmaku/app/frontend/assets/index-69687512.js create mode 100644 nonebot_plugin_blive_danmaku/app/frontend/assets/index-89088ace.js create mode 100644 nonebot_plugin_blive_danmaku/app/frontend/assets/index-9a172246.css delete mode 100644 nonebot_plugin_blive_danmaku/app/frontend/assets/index-a662ddb2.css delete mode 100644 nonebot_plugin_blive_danmaku/app/frontend/assets/index-e1716a6f.js delete mode 100644 nonebot_plugin_blive_danmaku/app/frontend/assets/index-e2ab3243.js diff --git a/nonebot_plugin_blive_danmaku/__init__.py b/nonebot_plugin_blive_danmaku/__init__.py index df770d5..71de451 100644 --- a/nonebot_plugin_blive_danmaku/__init__.py +++ b/nonebot_plugin_blive_danmaku/__init__.py @@ -1,7 +1,6 @@ from .utils import on_startup from nonebot import get_driver, get_app from nonebot.log import logger -from .config import danmaku_config driver = get_driver() driver.on_startup(on_startup) diff --git a/nonebot_plugin_blive_danmaku/app/frontend/assets/index-123dda7d.js b/nonebot_plugin_blive_danmaku/app/frontend/assets/index-123dda7d.js deleted file mode 100644 index 84e7310..0000000 --- a/nonebot_plugin_blive_danmaku/app/frontend/assets/index-123dda7d.js +++ /dev/null @@ -1 +0,0 @@ -import{ay as e,D as t,a2 as r,X as o,Y as n,o as s,_ as a,u as i,ae as l,e as d,L as u,az as c,al as p,aA as m,aB as f,aC as h,av as y}from"./vendor-b101ffcd.js";import{E as _,h as g,a as E,b,c as w,d as k,e as v,f as L}from"./elementPlus-f16563b7.js";import"./lodash-a70ac895.js";!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))t(e);new MutationObserver((e=>{for(const r of e)if("childList"===r.type)for(const e of r.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&t(e)})).observe(document,{childList:!0,subtree:!0})}function t(e){if(e.ep)return;e.ep=!0;const t=function(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?t.credentials="include":"anonymous"===e.crossOrigin?t.credentials="omit":t.credentials="same-origin",t}(e);fetch(e.href,t)}}();const N=e("storeId",{state:()=>({type_id:0,type:""}),getters:{getTypeId:e=>e.type_id,getType:e=>e.type},actions:{setState(e,t){if(!e||!t)throw new Error("参数错误,需要从bot提供的地址进入");if(isNaN(Number(e)))throw new TypeError("type_id类型错误");{const r=Number(e);this.type=t,this.type_id=r}}}}),P=t({__name:"App",setup(e){const t=r({width:window.innerWidth+"px"}),m=c(),f=N(),h=()=>{const e=f.getTypeId,t=f.getType;m.push({path:"/",query:{type:t,type_id:e}})};return(e,r)=>{const c=E,m=b,f=w,y=k,N=p("RouterView"),P=v,T=L,x=_;return s(),o(x,null,{default:n((()=>[a(y,{target:".el-container"},{default:n((()=>[a(f,{"background-color":"#545c64","text-color":"#fff",ellipsis:!1,router:!0,mode:"horizontal"},{default:n((()=>[a(m,{index:"0",onClick:h},{default:n((()=>[a(c,null,{default:n((()=>[a(i(g))])),_:1}),l(" blive-danmaku ")])),_:1})])),_:1}),d("div",{class:"h-6",style:u(t)},null,4)])),_:1}),a(P,{class:"danmaku-main"},{default:n((()=>[a(N)])),_:1}),a(T,{right:100,bottom:100})])),_:1})}}}),T={},x=function(e,t,r){if(!t||0===t.length)return e();const o=document.getElementsByTagName("link");return Promise.all(t.map((e=>{if((e=function(e){return"/danmaku/"+e}(e))in T)return;T[e]=!0;const t=e.endsWith(".css"),n=t?'[rel="stylesheet"]':"";if(!!r)for(let r=o.length-1;r>=0;r--){const n=o[r];if(n.href===e&&(!t||"stylesheet"===n.rel))return}else if(document.querySelector(`link[href="${e}"]${n}`))return;const s=document.createElement("link");return s.rel=t?"stylesheet":"modulepreload",t||(s.as="script",s.crossOrigin=""),s.href=e,document.head.appendChild(s),t?new Promise(((t,r)=>{s.addEventListener("load",t),s.addEventListener("error",(()=>r(new Error(`Unable to preload CSS for ${e}`))))})):void 0}))).then((()=>e()))},I=m({history:f(),routes:[{name:"home",path:"/",component:()=>x((()=>import("./index-e2ab3243.js")),["assets/index-e2ab3243.js","assets/elementPlus-f16563b7.js","assets/vendor-b101ffcd.js","assets/lodash-a70ac895.js","assets/elementPlus-d655f643.css","assets/config-758143a0.js"])},{name:"room",path:"/room",component:()=>x((()=>import("./index-e1716a6f.js")),["assets/index-e1716a6f.js","assets/elementPlus-f16563b7.js","assets/vendor-b101ffcd.js","assets/lodash-a70ac895.js","assets/elementPlus-d655f643.css","assets/config-758143a0.js","assets/index-a662ddb2.css"])}]}),O=h(),j=y(P);j.use(I),j.use(O),j.mount("#app");export{N as u}; diff --git a/nonebot_plugin_blive_danmaku/app/frontend/assets/index-1ac547dd.js b/nonebot_plugin_blive_danmaku/app/frontend/assets/index-1ac547dd.js new file mode 100644 index 0000000..202199f --- /dev/null +++ b/nonebot_plugin_blive_danmaku/app/frontend/assets/index-1ac547dd.js @@ -0,0 +1 @@ +import{g as e,i as a,j as t,v as s,k as r,l as o,m as l,n,o as i,p as u}from"./elementPlus-f16563b7.js";import{D as d,r as p,s as c,d as m,U as g,X as v,Y as f,_ as y,F as _,aD as b,o as x,ah as h,az as j,e as k,a0 as $,u as w,ae as C}from"./vendor-b101ffcd.js";import{g as E,b as z,C as D}from"./config-758143a0.js";import{u as P}from"./index-89088ace.js";import"./lodash-a70ac895.js";const T={style:{padding:"14px"}},U={class:"bottom"},q={class:"time"},F=d({__name:"index",setup(d){const F=p([]),I=p(0),O=p(1),S=p(!0),X=P();document.title="主页-blive_danmaku";const Y=()=>{},A=()=>{S.value=!0;const a=X.getType,t=X.getTypeId;if(!a||!t)return e({title:"Error",message:"当前地址有误,请从bot重新获取面板地址",type:"error"}),S.value=!1,!1;b.get(`${z}/api/get_sub_list`,{params:{type:a,type_id:t,page:O.value,size:30}}).then((async a=>{if(0!=a.data.code)e({title:"Error",message:"系统异常",type:"error"});else{const e=a.data.data;I.value=e.total;const t=e.rows;for(let a of t){const e=(await b.get(`${z}/api/get_cover?url=${a.cover}`)).data;0===e.code&&(a.cover=`${z}${e.data.data}`)}Object.assign(F.value,t)}S.value=!1})).catch((a=>{S.value=!1,e({title:"Error",message:"请求异常",type:"error"})}))},B=j();return c((()=>{const e=E("type"),a=E("type_id");X.setState(a,e),A()})),(e,d)=>{const p=n,c=i,b=u,j=a,E=o,z=l,P=t,X=s,G=r;return x(),m(_,null,[g((x(),v(j,{wrap:"","infinite-scroll-disabled":true},{default:f((()=>[(x(!0),m(_,null,h(F.value,((e,a)=>(x(),v(b,{key:e,"body-style":{padding:"1px"},style:{width:"26em"}},{default:f((()=>[y(p,{src:e.cover,"referrer-policy":"no-referrer",style:{cursor:"pointer"},onClick:a=>{return t=e.id,void B.push({path:"/room",query:{roomid:t}});var t}},null,8,["src","onClick"]),k("div",T,[k("span",null,$(e.title),1),k("div",U,[k("time",q,$(w(D)(e.start_time))+" ~ "+$(w(D)(e.end_time)),1),y(c,{text:"",class:"button"},{default:f((()=>[C($(e.name),1)])),_:2},1024)])])])),_:2},1024)))),128))])),_:1})),[[X,S.value],[G,Y]]),y(P,{gutter:20,style:{"margin-top":"20px"}},{default:f((()=>[y(z,{span:12,offset:10},{default:f((()=>[y(E,{background:"",layout:"prev,pager,next",total:I.value,"current-page":O.value,"onUpdate:currentPage":A},null,8,["total","current-page"])])),_:1})])),_:1})],64)}}});export{F as default}; diff --git a/nonebot_plugin_blive_danmaku/app/frontend/assets/index-69687512.js b/nonebot_plugin_blive_danmaku/app/frontend/assets/index-69687512.js new file mode 100644 index 0000000..356d012 --- /dev/null +++ b/nonebot_plugin_blive_danmaku/app/frontend/assets/index-69687512.js @@ -0,0 +1 @@ +import{g as a,E as e,j as t,v as s,s as l,n as r,q as o,r as u,t as n,u as i,e as d,w as m,m as c}from"./elementPlus-f16563b7.js";import{g as f,b as p,C as v,F as _}from"./config-758143a0.js";import{D as g,r as y,k as h,s as k,U as x,d as b,_ as j,Y as w,e as $,aD as E,o as F,a0 as V,ae as D,u as O,F as U,ah as q,aE as C,aF as I}from"./vendor-b101ffcd.js";import{u as P}from"./index-89088ace.js";import"./lodash-a70ac895.js";const S={style:{"padding-top":"10%"}},Y={class:"el-descriptions",style:{color:"var(--el-color-primary)"}},z={class:"demo-input-suffix"},A=(a=>(C("data-v-79a87744"),a=a(),I(),a))((()=>$("span",{class:"ml-3 w-30 text-gray-600 inline-flex items-center"},"路灯:",-1))),B={class:"ml-2"},G=((a,e)=>{const t=a.__vccOpts||a;for(const[s,l]of e)t[s]=l;return t})(g({__name:"index",setup(g){const C=y([]),I=y({}),G=y({danmaku:""}),H=y(!0),J=h((()=>{const a=G.value.danmaku;return a?C.value.filter((e=>e.message.includes(a)||e.uname.includes(a))):C.value}));return k((()=>{const e=f("type"),t=f("type_id");if(null!=e&&null!=t){P().setState(t,e)}(()=>{const e=f("roomid");if(null==e)return a({title:"Error",message:"房间号不存在,请返回上一页重新进入",type:"error"}),!1;H.value=!0,E.get(`${p}/api/get_room`,{params:{id:e}}).then((async e=>{if(0!=e.data.code)a({title:"Error",message:"系统异常",type:"error"});else{const a=e.data.data,t=(await E.get(`${p}/api/get_cover?url=${a.room_info.cover}`)).data;document.title=`${a.room_info.name}-blive-danmaku`,0===t.code&&(a.room_info.cover=`${p}${t.data.data}`),I.value=a.room_info,Object.assign(C.value,a.danmaku)}H.value=!1})).catch((e=>{H.value=!1,a({title:"Error",message:"请求异常",type:"error"})}))})()})),(a,f)=>{const p=r,g=o,y=u,h=n,k=i,E=d,C=e,P=m,K=t,L=c,M=s;return x((F(),b("div",S,[j(C,null,{default:w((()=>[j(g,null,{default:w((()=>[j(p,{style:{width:"60%"},src:I.value.cover,fit:"fill"},null,8,["src"])])),_:1}),j(E,null,{default:w((()=>[j(k,{column:2},{title:w((()=>[j(y,{type:"primary",target:"_blank",href:"https://space.bilibili.com/"+I.value.uid},{default:w((()=>[$("div",Y,V(I.value.title),1)])),_:1},8,["href"])])),default:w((()=>[j(h,{label:"开始时间"},{default:w((()=>[D(V(O(v)(I.value.start_time)),1)])),_:1}),j(h,{label:"结束时间"},{default:w((()=>[D(V(O(v)(I.value.end_time)),1)])),_:1})])),_:1})])),_:1})])),_:1}),$("div",z,[j(K,{gutter:20},{default:w((()=>[A,j(P,{class:"w-50",style:{width:"12.5rem"},modelValue:G.value.danmaku,"onUpdate:modelValue":f[0]||(f[0]=a=>G.value.danmaku=a),placeholder:"请在此输入搜索内容","prefix-icon":O(l)},null,8,["modelValue","prefix-icon"])])),_:1})]),j(K,{gutter:20},{default:w((()=>[j(L,{span:24},{default:w((()=>[(F(!0),b(U,null,q(O(J),(a=>(F(),b("ul",{style:{"text-align":"left"},key:a.id},[$("span",B,V(O(_)(a.create_time))+" ("+V(a.live_duration)+") : "+V(a.uname)+" "+V(a.message),1)])))),128))])),_:1})])),_:1})])),[[M,H.value]])}}}),[["__scopeId","data-v-79a87744"]]);export{G as default}; diff --git a/nonebot_plugin_blive_danmaku/app/frontend/assets/index-89088ace.js b/nonebot_plugin_blive_danmaku/app/frontend/assets/index-89088ace.js new file mode 100644 index 0000000..af090a6 --- /dev/null +++ b/nonebot_plugin_blive_danmaku/app/frontend/assets/index-89088ace.js @@ -0,0 +1 @@ +import{ay as e,D as t,r,X as o,Y as s,o as n,_ as a,L as i,u as l,ae as d,e as u,az as c,al as m,aA as p,aB as f,aC as y,av as h}from"./vendor-b101ffcd.js";import{E as _,h as g,a as E,b,c as k,d as v,e as w,f as L}from"./elementPlus-f16563b7.js";import"./lodash-a70ac895.js";!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))t(e);new MutationObserver((e=>{for(const r of e)if("childList"===r.type)for(const e of r.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&t(e)})).observe(document,{childList:!0,subtree:!0})}function t(e){if(e.ep)return;e.ep=!0;const t=function(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?t.credentials="include":"anonymous"===e.crossOrigin?t.credentials="omit":t.credentials="same-origin",t}(e);fetch(e.href,t)}}();const N=e("storeId",{state:()=>({type_id:0,type:""}),getters:{getTypeId:e=>e.type_id,getType:e=>e.type},actions:{setState(e,t){if(!e||!t)throw new Error("参数错误,需要从bot提供的地址进入");if(isNaN(Number(e)))throw new TypeError("type_id类型错误");{const r=Number(e);this.type=t,this.type_id=r}}}}),P=t({__name:"App",setup(e){const t=r({width:window.innerWidth+"px"}),p=c(),f=N(),y=()=>{const e=f.getTypeId,t=f.getType;p.push({path:"/",query:{type:t,type_id:e}})};return(e,r)=>{const c=E,p=b,f=k,h=v,N=m("RouterView"),P=w,T=L,x=_;return n(),o(x,null,{default:s((()=>[a(h,{offset:.1},{default:s((()=>[a(f,{"background-color":"#545c64","text-color":"#fff",ellipsis:!1,router:!0,style:i(t.value),mode:"horizontal"},{default:s((()=>[a(p,{index:"0",onClick:y},{default:s((()=>[a(c,null,{default:s((()=>[a(l(g))])),_:1}),d(" blive-danmaku ")])),_:1})])),_:1},8,["style"]),u("div",{class:"h-6",id:"danmaku-menu-line",style:i(t.value)},null,4)])),_:1},8,["offset"]),a(P,{class:"danmaku-main"},{default:s((()=>[a(N)])),_:1}),a(T,{right:100,bottom:100})])),_:1})}}}),T={},x=function(e,t,r){if(!t||0===t.length)return e();const o=document.getElementsByTagName("link");return Promise.all(t.map((e=>{if((e=function(e){return"/danmaku/"+e}(e))in T)return;T[e]=!0;const t=e.endsWith(".css"),s=t?'[rel="stylesheet"]':"";if(!!r)for(let r=o.length-1;r>=0;r--){const s=o[r];if(s.href===e&&(!t||"stylesheet"===s.rel))return}else if(document.querySelector(`link[href="${e}"]${s}`))return;const n=document.createElement("link");return n.rel=t?"stylesheet":"modulepreload",t||(n.as="script",n.crossOrigin=""),n.href=e,document.head.appendChild(n),t?new Promise(((t,r)=>{n.addEventListener("load",t),n.addEventListener("error",(()=>r(new Error(`Unable to preload CSS for ${e}`))))})):void 0}))).then((()=>e()))},I=p({history:f(),routes:[{name:"home",path:"/",component:()=>x((()=>import("./index-1ac547dd.js")),["assets/index-1ac547dd.js","assets/elementPlus-f16563b7.js","assets/vendor-b101ffcd.js","assets/lodash-a70ac895.js","assets/elementPlus-d655f643.css","assets/config-758143a0.js"])},{name:"room",path:"/room",component:()=>x((()=>import("./index-69687512.js")),["assets/index-69687512.js","assets/elementPlus-f16563b7.js","assets/vendor-b101ffcd.js","assets/lodash-a70ac895.js","assets/elementPlus-d655f643.css","assets/config-758143a0.js","assets/index-9a172246.css"])}]}),O=y(),j=h(P);j.use(I),j.use(O),j.mount("#app");export{N as u}; diff --git a/nonebot_plugin_blive_danmaku/app/frontend/assets/index-9a172246.css b/nonebot_plugin_blive_danmaku/app/frontend/assets/index-9a172246.css new file mode 100644 index 0000000..d7da6e6 --- /dev/null +++ b/nonebot_plugin_blive_danmaku/app/frontend/assets/index-9a172246.css @@ -0,0 +1 @@ +.demo-input-suffix[data-v-79a87744]{margin-top:3%} diff --git a/nonebot_plugin_blive_danmaku/app/frontend/assets/index-a662ddb2.css b/nonebot_plugin_blive_danmaku/app/frontend/assets/index-a662ddb2.css deleted file mode 100644 index caaa575..0000000 --- a/nonebot_plugin_blive_danmaku/app/frontend/assets/index-a662ddb2.css +++ /dev/null @@ -1 +0,0 @@ -.demo-input-suffix[data-v-9776bd83]{margin-top:3%} diff --git a/nonebot_plugin_blive_danmaku/app/frontend/assets/index-e1716a6f.js b/nonebot_plugin_blive_danmaku/app/frontend/assets/index-e1716a6f.js deleted file mode 100644 index bbdc7d3..0000000 --- a/nonebot_plugin_blive_danmaku/app/frontend/assets/index-e1716a6f.js +++ /dev/null @@ -1 +0,0 @@ -import{g as a,E as e,j as t,v as s,s as l,n as r,q as o,r as u,t as n,u as i,e as d,w as m,m as c}from"./elementPlus-f16563b7.js";import{g as f,b as v,C as p,F as _}from"./config-758143a0.js";import{D as g,r as y,k as b,s as h,U as k,d as x,_ as j,Y as w,e as $,aD as E,o as F,a0 as V,ae as D,u as O,F as U,ah as q,aE as C,aF as I}from"./vendor-b101ffcd.js";import"./lodash-a70ac895.js";const P={style:{"padding-top":"10%"}},Y={class:"el-descriptions",style:{color:"var(--el-color-primary)"}},z={class:"demo-input-suffix"},A=(a=>(C("data-v-9776bd83"),a=a(),I(),a))((()=>$("span",{class:"ml-3 w-30 text-gray-600 inline-flex items-center"},"路灯:",-1))),B={class:"ml-2"},G=((a,e)=>{const t=a.__vccOpts||a;for(const[s,l]of e)t[s]=l;return t})(g({__name:"index",setup(g){const C=y([]),I=y({}),G=y({danmaku:""}),H=y(!0),J=b((()=>{const a=G.value.danmaku;return a?C.value.filter((e=>e.message.includes(a)||e.uname.includes(a))):C.value}));return h((()=>{(()=>{const e=f("roomid");if(null==e)return a({title:"Error",message:"房间号不存在,请返回上一页重新进入",type:"error"}),!1;H.value=!0,E.get(`${v}/api/get_room`,{params:{id:e}}).then((async e=>{if(0!=e.data.code)a({title:"Error",message:"系统异常",type:"error"});else{const a=e.data.data,t=(await E.get(`${v}/api/get_cover?url=${a.room_info.cover}`)).data;document.title=`${a.room_info.name}-blive-danmaku`,0===t.code&&(a.room_info.cover=`${v}${t.data.data}`),I.value=a.room_info,Object.assign(C.value,a.danmaku)}H.value=!1})).catch((a=>{H.value=!1}))})()})),(a,f)=>{const v=r,g=o,y=u,b=n,h=i,E=d,C=e,K=m,L=t,M=c,N=s;return k((F(),x("div",P,[j(C,null,{default:w((()=>[j(g,null,{default:w((()=>[j(v,{style:{width:"60%"},src:I.value.cover,fit:"fill"},null,8,["src"])])),_:1}),j(E,null,{default:w((()=>[j(h,{column:2},{title:w((()=>[j(y,{type:"primary",target:"_blank",href:"https://space.bilibili.com/"+I.value.uid},{default:w((()=>[$("div",Y,V(I.value.title),1)])),_:1},8,["href"])])),default:w((()=>[j(b,{label:"开始时间"},{default:w((()=>[D(V(O(p)(I.value.start_time)),1)])),_:1}),j(b,{label:"结束时间"},{default:w((()=>[D(V(O(p)(I.value.end_time)),1)])),_:1})])),_:1})])),_:1})])),_:1}),$("div",z,[j(L,{gutter:20},{default:w((()=>[A,j(K,{class:"w-50",style:{width:"12.5rem"},modelValue:G.value.danmaku,"onUpdate:modelValue":f[0]||(f[0]=a=>G.value.danmaku=a),placeholder:"请在此输入搜索内容","prefix-icon":O(l)},null,8,["modelValue","prefix-icon"])])),_:1})]),j(L,{gutter:20},{default:w((()=>[j(M,{span:24},{default:w((()=>[(F(!0),x(U,null,q(O(J),(a=>(F(),x("ul",{style:{"text-align":"left"},key:a.id},[$("span",B,V(O(_)(a.create_time))+" ("+V(a.live_duration)+") : "+V(a.uname)+" "+V(a.message),1)])))),128))])),_:1})])),_:1})])),[[N,H.value]])}}}),[["__scopeId","data-v-9776bd83"]]);export{G as default}; diff --git a/nonebot_plugin_blive_danmaku/app/frontend/assets/index-e2ab3243.js b/nonebot_plugin_blive_danmaku/app/frontend/assets/index-e2ab3243.js deleted file mode 100644 index 9974060..0000000 --- a/nonebot_plugin_blive_danmaku/app/frontend/assets/index-e2ab3243.js +++ /dev/null @@ -1 +0,0 @@ -import{g as a,i as e,j as t,v as s,k as r,l as o,m as l,n,o as i,p as u}from"./elementPlus-f16563b7.js";import{D as d,a2 as p,r as c,s as m,d as v,U as f,X as g,Y as y,_,F as b,aD as x,o as h,ah as j,az as k,e as $,a0 as w,u as C,ae as z}from"./vendor-b101ffcd.js";import{g as D,b as E,C as P}from"./config-758143a0.js";import{u as U}from"./index-123dda7d.js";import"./lodash-a70ac895.js";const q={style:{padding:"14px"}},A={class:"bottom"},F={class:"time"},O=d({__name:"index",setup(d){const O=p(Array({})),S=c(0),X=c(1),Y=c(!0);document.title="主页-blive_danmaku";const B=()=>{},G=()=>{Y.value=!0;const e=D("type"),t=D("type_id");if(null==e||null==t)return a({title:"Error",message:"当前地址有误,请从bot重新获取订阅地址",type:"error"}),Y.value=!1,!1;x.get(`${E}/api/get_sub_list`,{params:{type:e,type_id:t,page:X.value,size:30}}).then((async e=>{if(0!=e.data.code)a({title:"Error",message:"系统异常",type:"error"});else{const a=e.data.data;S.value=a.total;const t=a.rows;for(let e of t){const a=(await x.get(`${E}/api/get_cover?url=${e.cover}`)).data;0===a.code&&(e.cover=`${E}${a.data.data}`)}Object.assign(O,t)}Y.value=!1})).catch((a=>{Y.value=!1}))},H=k();return m((()=>{const a=U(),e=D("type"),t=D("type_id");a.setState(t,e),G()})),(a,d)=>{const p=n,c=i,m=u,x=e,k=o,D=l,E=t,U=s,I=r;return h(),v(b,null,[f((h(),g(x,{wrap:"","infinite-scroll-disabled":true},{default:y((()=>[(h(!0),v(b,null,j(O,((a,e)=>(h(),g(m,{key:a,"body-style":{padding:"1px"},style:{width:"26em"}},{default:y((()=>[_(p,{src:a.cover,"referrer-policy":"no-referrer",style:{cursor:"pointer"},onClick:e=>{return t=a.id,void H.push({path:"/room",query:{roomid:t}});var t}},null,8,["src","onClick"]),$("div",q,[$("span",null,w(a.title),1),$("div",A,[$("time",F,w(C(P)(a.start_time))+" ~ "+w(C(P)(a.end_time)),1),_(c,{text:"",class:"button"},{default:y((()=>[z(w(a.name),1)])),_:2},1024)])])])),_:2},1024)))),128))])),_:1})),[[U,Y.value],[I,B]]),_(E,{gutter:20,style:{"margin-top":"20px"}},{default:y((()=>[_(D,{span:12,offset:10},{default:y((()=>[_(k,{background:"",layout:"prev,pager,next",total:S.value,"current-page":X.value,"onUpdate:currentPage":G},null,8,["total","current-page"])])),_:1})])),_:1})],64)}}});export{O as default}; diff --git a/nonebot_plugin_blive_danmaku/app/frontend/index.html b/nonebot_plugin_blive_danmaku/app/frontend/index.html index 816c093..5b9931d 100644 --- a/nonebot_plugin_blive_danmaku/app/frontend/index.html +++ b/nonebot_plugin_blive_danmaku/app/frontend/index.html @@ -5,7 +5,7 @@ nonebot-plugin-blive-danmaku - + diff --git a/nonebot_plugin_blive_danmaku/command/subscribe/danmaku.py b/nonebot_plugin_blive_danmaku/command/subscribe/danmaku.py index 670271d..6ef404a 100644 --- a/nonebot_plugin_blive_danmaku/command/subscribe/danmaku.py +++ b/nonebot_plugin_blive_danmaku/command/subscribe/danmaku.py @@ -5,6 +5,8 @@ from ...blivedm import blivedm from ...database import Db as db from nonebot.log import logger +from ...config import danmaku_config +from nonebot import get_driver class ClientModel: @@ -71,7 +73,14 @@ async def danmaku(): room_list = await db.get_rooms(room_id=room_id, uid=uid) room_list.sort(key=lambda x:x.start_time, reverse=True) room = room_list[0] - await db.update_room("end_time", now, room_id=room_id, uid=uid, start_time=room.start_time) + await db.update_room("end_time", now, id=room.id) + + driver = get_driver() + host = danmaku_config.danmaku_host if danmaku_config.danmaku_host else f"http://{driver.config.host}:{driver.config.port}" + subs = await db.get_subs(uid=uid,street_lamp=True) + for sub in subs: + msg = f'{info["uname"]}下播了,可前往面板查看本次直播的路灯记录:{host}/danmaku/#/room?roomid={room.id}&type={sub.type}&type_id={sub.type_id}' + await send_msg(bot_id=sub.bot_id,send_type=sub.type,type_id=sub.type_id,message=msg) @@ -100,6 +109,18 @@ async def _on_danmaku(self, client: blivedm.BLiveClient, message: blivedm.Danmak room_list.sort(key=lambda x:x.start_time, reverse=True) room = room_list[0] await db.add_danmaku(room_id=room.id, uname=message.uname, message=blive_danmaku, create_time=datetime, live_duration=dt) + + async def _on_buy_guard(self, client: blivedm.BLiveClient, message: blivedm.GuardBuyMessage): + logger.debug(f"[{client.room_id}] {message.username} 购买{message.gift_name}") + + async def _on_super_chat(self, client: blivedm.BLiveClient, message: blivedm.SuperChatMessage): + logger.debug(f"[{client.room_id}] SC ¥{message.price} {message.uname}:{message.message}") + + async def _on_gift(self, client: blivedm.BLiveClient, message: blivedm.GiftMessage): + logger.debug(f"[{client.room_id}] {message.uname} 赠送{message.gift_name}x{message.num}") + + async def _on_heartbeat(self, client: blivedm.BLiveClient, message: blivedm.HeartbeatMessage): + logger.debug(f"[{client.room_id}] 当前人气值:{message.popularity}") async def disconnect_room(model): diff --git a/nonebot_plugin_blive_danmaku/command/subscribe/live.py b/nonebot_plugin_blive_danmaku/command/subscribe/live.py index 62e5bd5..557e295 100644 --- a/nonebot_plugin_blive_danmaku/command/subscribe/live.py +++ b/nonebot_plugin_blive_danmaku/command/subscribe/live.py @@ -5,7 +5,7 @@ from nonebot.log import logger from nonebot.adapters.onebot.v11 import MessageSegment from ...database import Db as db -from ...config import Config +from ...config import danmaku_config live_uids = {} @@ -16,8 +16,7 @@ ) async def live(): """开播提醒""" - plugin_config = Config.parse_obj(get_driver().config) - if plugin_config.danmaku_group_notice is False: + if danmaku_config.danmaku_group_notice is False: return uids = db.get_sub_list("live") diff --git a/pyproject.toml b/pyproject.toml index de91722..75f9729 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "nonebot-plugin-blive-danmaku" -version = "0.2.3" +version = "0.2.4" description = "A danmaku plugin for Nonebot2" authors = ["ricardo "] documentation = "https://github.com/zangxx66/nonebot_plugin_blive_danmaku#readme"