From 5c0ed5e13f1231de122bf60d3f9d8c00fa9c960f Mon Sep 17 00:00:00 2001
From: Jerry Yan <792602257@qq.com>
Date: Wed, 1 Jan 2020 13:30:26 +0800
Subject: [PATCH] DEMO CHECK

---
 api.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/api.py b/api.py
index 837e116..cb8fe6e 100644
--- a/api.py
+++ b/api.py
@@ -351,7 +351,9 @@ class XiGuaLiveApi:
                 print(i)
             if "common" not in i and "method" not in i["common"]:
                 continue
-            if i["common"]['method'] == "VideoLivePresentEndTipMessage":
+            if i["common"]['method'] == "VideoLivePresentMessage":
+                self.onPresent(Gift(i))
+            elif i["common"]['method'] == "VideoLivePresentEndTipMessage":
                 self.onPresentEnd(Gift(i))
             # elif i["common"]['method'] == "VideoLiveRoomAdMessage":
             #     self.onAd(i)
@@ -391,14 +393,14 @@ if __name__ == "__main__":
             DEBUG = True
         name = sys.argv[1]
     print("西瓜直播弹幕助手 by JerryYan")
-    print("用户名【", name, "】搜索中", end="\t")
+    print("搜索【", name, "】中", end="\t", flush=True)
     api = XiGuaLiveApi(name)
     if not api.isValidUser:
         input("用户不存在")
         sys.exit()
     print("OK")
     print("直播用户:", api.broadcaster)
-    print("更新房间信息,请稍后", end="\t")
+    print("更新房间信息,请稍后", end="\t", flush=True)
     if api.updRoomInfo(True):
         print("OK")
     else:
@@ -417,4 +419,4 @@ if __name__ == "__main__":
         else:
             print("主播未开播,等待1分钟后重试")
             time.sleep(60)
-            api.updRoomInfo()
+            api.updRoomInfo(True)