增加DEBUG模式
This commit is contained in:
parent
414aef7eb3
commit
ef732aa965
9
api.py
9
api.py
@ -9,6 +9,7 @@ import time
|
|||||||
|
|
||||||
s = requests.Session()
|
s = requests.Session()
|
||||||
|
|
||||||
|
DEBUG:bool = False
|
||||||
|
|
||||||
class XiGuaLiveApi:
|
class XiGuaLiveApi:
|
||||||
isLive: bool = False
|
isLive: bool = False
|
||||||
@ -121,7 +122,8 @@ class XiGuaLiveApi:
|
|||||||
if "LiveMsgs" not in d["data"]:
|
if "LiveMsgs" not in d["data"]:
|
||||||
return
|
return
|
||||||
for i in d['data']['LiveMsgs']:
|
for i in d['data']['LiveMsgs']:
|
||||||
print(i)
|
if DEBUG:
|
||||||
|
print(i)
|
||||||
if i['Method'] == "VideoLivePresentMessage":
|
if i['Method'] == "VideoLivePresentMessage":
|
||||||
self.onPresent(Gift(i))
|
self.onPresent(Gift(i))
|
||||||
elif i['Method'] == "VideoLivePresentEndTipMessage":
|
elif i['Method'] == "VideoLivePresentEndTipMessage":
|
||||||
@ -149,6 +151,11 @@ if __name__ == "__main__":
|
|||||||
room = 97621754276 # 永恒
|
room = 97621754276 # 永恒
|
||||||
# room = 75366565294
|
# room = 75366565294
|
||||||
# room = 83940182312 #Dae
|
# room = 83940182312 #Dae
|
||||||
|
if len(sys.argv) > 1:
|
||||||
|
if sys.argv[-1] == "d":
|
||||||
|
DEBUG = True
|
||||||
|
room = int(sys.argv[1])
|
||||||
|
|
||||||
print("西瓜直播弹幕助手 by JerryYan")
|
print("西瓜直播弹幕助手 by JerryYan")
|
||||||
api = XiGuaLiveApi(room)
|
api = XiGuaLiveApi(room)
|
||||||
print("进入", api.roomLiver, "的直播间")
|
print("进入", api.roomLiver, "的直播间")
|
||||||
|
Reference in New Issue
Block a user