Esempio n. 1
0
 def OnLIVE(self, data):
     '''开播调用'''
     INFO(
         f'{self.roomid}[{self.info.get("showname",self.info.get("name"))}]收到开播推送'
     )
     if not self.status:
         for group in self.info['Group']:
             msg = MsgChain()
             if group['ATall']:
                 msg.joinAT(-1)
             msg.joinPlain(
                 f'你的小可爱{self.info.get("showname",self.info.get("name"))}开播啦~'
             )
             if self.title:
                 msg.joinPlain(f'\n【{self.title}】')
             if group['sendPic']:
                 ''''''
             if group['sendUrl']:
                 msg.joinPlain(f'\nhttps://live.bilibili.com/{self.roomid}')
             Send['sendGroupMsg'](group['id'], msg)
             time.sleep(0.2)
     self.status = True
     #保存开播日志在弹幕表中
     if self.info.get('savedanmu'):
         self.SQL.savedanmu(
             time.time() * 1000,  #时间
             'null',  #用户名
             'null',  #用户uid
             'LIVE'  #弹幕
         )
Esempio n. 2
0
File: Acfun.py Progetto: onlynull/zr
 def LiveLoad(self) -> MsgChain:
     '''开播推送信息'''
     if self.Live == False:  #为开播,不发送
         ERROR("主播未开播,无法载入相关信息")
         return MsgChain()
     Msg = MsgChain()
     if self.user.get('ATall'):
         Msg.joinAT(-1)
         Msg.joinPlain(" \n")
     Msg.joinPlain(
         f'你的小可爱[{self.Name}]开播啦~\n{self.LiveInfo.get("title","")}\n{self.LiveInfo.get("type",{}).get("name","")}\nhttps://live.acfun.cn/live/{self.Uid}'
     )
     Msg.joinImg(Url=self.LiveInfo.get('coverUrls', [""])[0])
     return Msg
Esempio n. 3
0
File: Acfun.py Progetto: onlynull/zr
 def DynamincLoad(self) -> MsgChain:
     '''载入将要推送的动态信息为MsgChain消息格式'''
     Msg = MsgChain()
     #判断一下是否有数据
     if self.OldDynamic.get('resourceId') == None:
         ERROR("获取到的数据有问题,无法正常推送。")
         return Msg
     Type = self.OldDynamic.get('moment', {}).get('originResourceType')
     if self.user.get('ATall'):
         Msg.joinAT(-1)
         Msg.joinPlain(" \n")
     if not Type:
         Msg.joinPlain(f'你的小可爱{self.Name}发布一条新动态了哦,快来看看吧~\n')
     else:
         Msg.joinPlain(f'你的小可爱{self.Name}转发一条新动态了\n')
     Msg = Msg + self.DynamicOriginalLoad(self.OldDynamic)
     Msg.joinPlain('\n' + self.OldDynamic['shareUrl'])
     return Msg
Esempio n. 4
0
File: Acfun.py Progetto: onlynull/zr
 def VideoLoad(self) -> MsgChain:
     '''载入将要推送的视频信息为MsgChain消息格式'''
     Msg = MsgChain()
     if self.user.get('ATall'):
         Msg.joinAT(-1)
         Msg.joinPlain(" \n")
     times = time.strftime(
         "%Y-%m-%d %H:%M:%S",
         time.localtime(float(
             int(self.OldVideo['createTimeMillis']) / 1000)))
     tags = []
     for tag in self.OldVideo['tagList']:
         tags.append(f'#{tag["name"]}#')
     Msg.joinPlain(
         f'你的小可爱{self.Name}有新作品了哦,快来看看吧~\n{self.OldVideo["title"]}\n{self.OldVideo["channel"]["parentName"]}·{self.OldVideo["channel"]["name"]} {times}'
     )
     Msg.joinImg(Url=self.OldVideo['coverUrl'])
     Msg.joinPlain(
         f'{self.OldVideo["description"]}\n{" ".join(tags)}\n{self.OldVideo["shareUrl"]}'
     )
     return Msg