@@ -154,13 +154,13 @@ async def parseDanMu(self, messages):
154154
155155 if cmd == 'DANMU_MSG' :
156156 # print(dic)
157- # self.printer.print_danmu_msg( dic)
157+ self .printer .printlist_append ([ 'danmu' , '弹幕' , 'user' , dic ] )
158158 pass
159159 if cmd == 'SYS_GIFT' :
160160 if 'giftId' in dic .keys ():
161161
162162 if str (dic ['giftId' ]) in self .bilibili .giftids_raffle .keys ():
163- print ( self .bilibili .giftids_raffle [str (dic ['giftId' ])])
163+ self . printer . printlist_append ([ 'join_lottery' , '活动名称' , 'user' , self .bilibili .giftids_raffle [str (dic ['giftId' ])] ])
164164 headers = {
165165 'Accept' : 'application/json, text/plain, */*' ,
166166 'User-Agent' : 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36' ,
@@ -175,10 +175,10 @@ async def parseDanMu(self, messages):
175175 self .api .post_watching_history (self .bilibili .csrf ,text1 )
176176 result = self .api .check_room_true (text1 )
177177 if True in result :
178- print ( time .strftime ('%Y-%m-%d %H:%M:%S' , time .localtime (time .time ())),"WARNING:检测到房间" ,str (text1 ).center (9 ),"的钓鱼操作" )
178+ self . printer . printlist_append ([ 'join_lottery' , '钓鱼提醒' , 'user' , time .strftime ('%Y-%m-%d %H:%M:%S' , time .localtime (time .time ())),"WARNING:检测到房间" ,str (text1 ).center (9 ),"的钓鱼操作" ] )
179179 else :
180180 url = 'http://api.live.bilibili.com/activity/v1/Raffle/check?roomid=' + str (text1 )
181- print ( time .strftime ('%Y-%m-%d %H:%M:%S' , time .localtime (time .time ())), "检测到房间" , str (text1 ).center (9 ), "的活动抽奖" )
181+ self . printer . printlist_append ([ 'join_lottery' , '' , 'user' , time .strftime ('%Y-%m-%d %H:%M:%S' , time .localtime (time .time ())), "检测到房间" , str (text1 ).center (9 ), "的活动抽奖" ] )
182182 response = requests .get (url , headers = headers )
183183 checklen = response .json ()['data' ]
184184 num = len (checklen )
@@ -188,7 +188,7 @@ async def parseDanMu(self, messages):
188188 resttime = response .json ()['data' ][j ]['time' ]
189189 raffleid = response .json ()['data' ][j ]['raffleId' ]
190190 if raffleid not in self .bilibili .activity_raffleid_list :
191- print ( time .strftime ('%Y-%m-%d %H:%M:%S' , time .localtime (time .time ())), "参与了房间" , str (text1 ).center (9 ), "的活动抽奖" )
191+ self . printer . printlist_append ([ 'join_lottery' , '' , 'user' , time .strftime ('%Y-%m-%d %H:%M:%S' , time .localtime (time .time ())), "参与了房间" , str (text1 ).center (9 ), "的活动抽奖" ] )
192192 self .bilibili .activity_raffleid_list .append (raffleid )
193193 self .bilibili .activity_roomid_list .append (text1 )
194194 self .bilibili .activity_time_list .append (resttime )
@@ -211,24 +211,22 @@ async def parseDanMu(self, messages):
211211 response1 = requests .get (true_url ,params = params , headers = headers )
212212 pc_response = requests .get (pc_url , headers = headers )
213213 try :
214- print ( "# 移动端活动抽奖结果:" , response1 .json ()['data' ]['gift_desc' ])
214+ self . printer . printlist_append ([ 'join_lottery' , '' , 'user' , "# 移动端活动抽奖结果:" , response1 .json ()['data' ]['gift_desc' ] ])
215215 except :
216216 pass
217217 try :
218- print ( "# 网页端活动抽奖状态:" , pc_response .json ()['message' ])
218+ self . printer . printlist_append ([ 'join_lottery' , '' , 'user' , "# 网页端活动抽奖状态:" , pc_response .json ()['message' ] ])
219219 except :
220220 pass
221221 break
222222 elif dic ['giftId' ] == 39 :
223- print ( "节奏风暴" )
223+ self . printer . printlist_append ([ 'join_lottery' , '' , 'user' , "节奏风暴" ] )
224224 self .get_prensent_of_storm (dic )
225225 else :
226- print (dic )
227- print ("请联系开发者" )
226+ self .printer .printlist_append (['join_lottery' ,'' ,'debug' , [dic , "请联系开发者" ]])
228227 else :
229- #print("礼物提示")
230- # print(dic["msg_text"])
231- pass
228+ self .printer .printlist_append (['join_lottery' ,'普通送礼提示' ,'user' , ['普通送礼提示' , dic ['msg_text' ]]])
229+ #self.printer.printlist_append(['join_lottery','','debug', [dic, "请联系开发者"]])
232230
233231
234232
@@ -250,8 +248,8 @@ async def parseDanMu(self, messages):
250248 self .api .post_watching_history (self .bilibili .csrf ,real_roomid )
251249 result = self .api .check_room_true (real_roomid )
252250 if True in result :
253- print ( time .strftime ('%Y-%m-%d %H:%M:%S' , time .localtime (time .time ())), "WARNING:检测到房间" ,
254- str (real_roomid ).center (9 ), "的钓鱼操作" )
251+ self . printer . printlist_append ([ 'join_lottery' , '' , 'debug' , time .strftime ('%Y-%m-%d %H:%M:%S' , time .localtime (time .time ())), "WARNING:检测到房间" ,
252+ str (real_roomid ).center (9 ), "的钓鱼操作" ] )
255253 else :
256254 check_url = 'https://api.live.bilibili.com/AppSmallTV/index?' + temp_params + '&sign=' + str (hash .hexdigest ())
257255 print (time .strftime ('%Y-%m-%d %H:%M:%S' , time .localtime (time .time ())), "检测到房间" , str (real_roomid ).center (9 ), "的小电视抽奖" )
@@ -272,7 +270,7 @@ async def parseDanMu(self, messages):
272270 resttime = response .json ()['data' ]['unjoin' ][j ]['dtime' ]
273271 raffleid = response .json ()['data' ]['unjoin' ][j ]['id' ]
274272 if raffleid not in self .bilibili .TV_raffleid_list :
275- print ( time .strftime ('%Y-%m-%d %H:%M:%S' , time .localtime (time .time ())), "参与了房间" , str (real_roomid ).center (9 ), "的小电视抽奖" )
273+ self . printer . printlist_append ([ 'join_lottery' , '小电视' , 'user' , time .strftime ('%Y-%m-%d %H:%M:%S' , time .localtime (time .time ())), "参与了房间" , str (real_roomid ).center (9 ), "的小电视抽奖" ] )
276274 self .bilibili .TV_raffleid_list .append (raffleid )
277275 self .bilibili .TV_roomid_list .append (real_roomid )
278276 self .bilibili .TV_time_list .append (resttime )
@@ -298,11 +296,12 @@ async def parseDanMu(self, messages):
298296 # real_roomid) + '&raffleId=' + str(raffleid)
299297 # #response1 = requests.get(url1, headers=headers)
300298 response2 = requests .get (true_url ,headers = self .bilibili .appheaders )
301- print ( "# 小电视道具抽奖状态:" ,response2 .json ()['msg' ])
299+ self . printer . printlist_append ([ 'join_lottery' , '小电视' , 'user' , "# 小电视道具抽奖状态:" ,response2 .json ()['msg' ] ])
302300 break
303301
304302 except :
305303 pass
304+ self .printer .printlist_append (['join_lottery' ,'小电视' ,'user' , "# error" , response .json ()])
306305 if cmd == 'GUARD_MSG' :
307306 try :
308307 print (dic )
@@ -338,5 +337,5 @@ async def parseDanMu(self, messages):
338337 print ("# 获取到某个总督的奖励:" ,response2 .json ()['data' ]['message' ])
339338
340339 except :
341- print ( "# 没领取到奖励,请联系开发者" )
340+ self . printer . printlist_append ([ 'join_lotter' , '' , 'develop' , "# 没领取到奖励,请联系开发者" ] )
342341 return
0 commit comments