mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2025-06-07 12:23:00 +08:00
auto fix by pre-commit hooks
This commit is contained in:
parent
aa29c57d05
commit
3204e84346
@ -5,7 +5,7 @@ import httpx
|
|||||||
|
|
||||||
from ..post import Post
|
from ..post import Post
|
||||||
from ..types import Category, RawPost, Tag, Target
|
from ..types import Category, RawPost, Tag, Target
|
||||||
from .platform import CategoryNotSupport, NewMessage,StatusChange
|
from .platform import CategoryNotSupport, NewMessage, StatusChange
|
||||||
|
|
||||||
|
|
||||||
class Bilibili(NewMessage):
|
class Bilibili(NewMessage):
|
||||||
@ -145,11 +145,12 @@ class Bilibili(NewMessage):
|
|||||||
raise CategoryNotSupport(post_type)
|
raise CategoryNotSupport(post_type)
|
||||||
return Post("bilibili", text=text, url=url, pics=pic, target_name=target_name)
|
return Post("bilibili", text=text, url=url, pics=pic, target_name=target_name)
|
||||||
|
|
||||||
|
|
||||||
class Bilibililive(StatusChange):
|
class Bilibililive(StatusChange):
|
||||||
# Author : Sichongzou
|
# Author : Sichongzou
|
||||||
# Date : 2022-5-18 8:54
|
# Date : 2022-5-18 8:54
|
||||||
# Description : bilibili开播提醒
|
# Description : bilibili开播提醒
|
||||||
# E-mail : 1557157806@qq.com
|
# E-mail : 1557157806@qq.com
|
||||||
categories = {}
|
categories = {}
|
||||||
platform_name = "bilibililive"
|
platform_name = "bilibililive"
|
||||||
enable_tag = True
|
enable_tag = True
|
||||||
@ -180,26 +181,31 @@ class Bilibililive(StatusChange):
|
|||||||
)
|
)
|
||||||
res_dict = json.loads(res.text)
|
res_dict = json.loads(res.text)
|
||||||
if res_dict["code"] == 0:
|
if res_dict["code"] == 0:
|
||||||
info={}
|
info = {}
|
||||||
info["uid"]=res_dict["data"]["mid"]
|
info["uid"] = res_dict["data"]["mid"]
|
||||||
info["uname"]=res_dict["data"]["name"]
|
info["uname"] = res_dict["data"]["name"]
|
||||||
info["live_state"]=res_dict["data"]["live_room"]["liveStatus"]
|
info["live_state"] = res_dict["data"]["live_room"]["liveStatus"]
|
||||||
info["url"]=res_dict["data"]["live_room"]["url"]
|
info["url"] = res_dict["data"]["live_room"]["url"]
|
||||||
info["title"]=res_dict["data"]["live_room"]["title"]
|
info["title"] = res_dict["data"]["live_room"]["title"]
|
||||||
info["cover"]=res_dict["data"]["live_room"]["cover"]
|
info["cover"] = res_dict["data"]["live_room"]["cover"]
|
||||||
return info
|
return info
|
||||||
else:
|
else:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def compare_status(self, target: Target, old_status, new_status) -> list[RawPost]:
|
def compare_status(self, target: Target, old_status, new_status) -> list[RawPost]:
|
||||||
if(new_status["live_state"]!=old_status["live_state"] and new_status["live_state"]==1):
|
if (
|
||||||
|
new_status["live_state"] != old_status["live_state"]
|
||||||
|
and new_status["live_state"] == 1
|
||||||
|
):
|
||||||
return [new_status]
|
return [new_status]
|
||||||
else:
|
else:
|
||||||
return[]
|
return []
|
||||||
|
|
||||||
async def parse(self, raw_post: RawPost) -> Post:
|
async def parse(self, raw_post: RawPost) -> Post:
|
||||||
url=raw_post["url"]
|
url = raw_post["url"]
|
||||||
pic=[raw_post["cover"]]
|
pic = [raw_post["cover"]]
|
||||||
target_name=raw_post["uname"]
|
target_name = raw_post["uname"]
|
||||||
text=target_name+"老师的直播 开播啦!小伙伴们请务必速速来围观!"
|
text = target_name + "老师的直播 开播啦!小伙伴们请务必速速来围观!"
|
||||||
return Post("bilibililive", text=text, url=url, pics=pic, target_name=target_name)
|
return Post(
|
||||||
|
"bilibililive", text=text, url=url, pics=pic, target_name=target_name
|
||||||
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user