避免无法更新状态的问题

This commit is contained in:
Jerry Yan 2021-02-01 10:51:25 +08:00
parent f4d65e9595
commit 3e49fa59bb

3
api.py
View File

@ -282,6 +282,7 @@ class XiGuaLiveApi:
return False
self.broadcaster = None
self.isValidUser = False
self.isLive = False
if "data" in d and d["data"] is not None:
for i in d["data"]:
if self.broadcaster is not None:
@ -310,6 +311,7 @@ class XiGuaLiveApi:
if self.broadcaster is None:
self.isValidUser = False
return False
self.isLive = False
_formatData = {"TIMESTAMP": time.time() * 1000, "userId": self.broadcaster.ID}
_COMMON = COMMON_GET_PARAM.format_map(_formatData)
_formatData['COMMON'] = _COMMON
@ -346,6 +348,7 @@ class XiGuaLiveApi:
return False
if (self._updRoomAt + timedelta(minutes=3) > datetime.now()) and not force:
return self.isLive
self.isLive = False
_formatData = {"TIMESTAMP": time.time() * 1000, "roomId": self.roomID}
_COMMON = COMMON_GET_PARAM.format_map(_formatData)
_formatData['COMMON'] = _COMMON