mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2026-06-23 22:16:53 +08:00
add ncm
This commit is contained in:
@@ -45,9 +45,9 @@ class NcmArtist(TargetMixin, NewMessage):
|
||||
def get_date(self, post: RawPost) -> int:
|
||||
return post['publishTime'] // 1000
|
||||
|
||||
def parse(self, raw_post: RawPost) -> Post:
|
||||
text = '新专辑发布:{}'.format(raw_post.name)
|
||||
target_name = raw_post.artist.name
|
||||
async def parse(self, raw_post: RawPost) -> Post:
|
||||
text = '新专辑发布:{}'.format(raw_post['name'])
|
||||
target_name = raw_post['artist']['name']
|
||||
pics = [raw_post['picUrl']]
|
||||
url = "https://music.163.com/#/album?id={}".format(raw_post['id'])
|
||||
return Post('ncm-artist', text=text, url=url, pics=pics, target_name=target_name)
|
||||
|
||||
@@ -114,9 +114,9 @@ class MessageProcessMixin(PlatformNameMixin, CategoryMixin, ParsePostMixin, abst
|
||||
self.parse_cache[post_id] = await self.parse(raw_post)
|
||||
break
|
||||
except Exception as err:
|
||||
retry_times -= 1
|
||||
if not retry_times:
|
||||
raise err
|
||||
retry_times -= 1
|
||||
return self.parse_cache[post_id]
|
||||
|
||||
@abstractmethod
|
||||
|
||||
Reference in New Issue
Block a user