]> 127.0.0.1 Git - bili_danmu/.git/commitdiff
在发送礼物前先获取主播uid
authorqydysky <qydysky@foxmail.com>
Tue, 16 Mar 2021 12:00:45 +0000 (20:00 +0800)
committerqydysky <qydysky@foxmail.com>
Tue, 16 Mar 2021 12:00:45 +0000 (20:00 +0800)
Send/Send_gift.go
bili_danmu.go

index 897628750bfe20ef2f35781a7411be506910ebce..4e68b53d347d86caa5d05a69a4df8c9872e94ccb 100644 (file)
@@ -18,6 +18,8 @@ func Send_gift(gift_id,bag_id,gift_num int) {
 
        if gift_limit.TO() {log.L(`W: `,"超时");return}
 
+       if c.UpUid == 0 {log.L(`W: `,"还未获取到Up主uid");return}
+
        {//发送请求(银瓜子礼物)
                csrf,_ := c.Cookie.LoadV(`bili_jct`).(string)
                if csrf == `` {log.L(`E: `,"Cookie错误,无bili_jct=");return}
index 91f0c182e97fc6662427bd1a419b9168d1336439..df49c053a0ef0500df0b6b5c83554b9d07fd5ebc 100644 (file)
@@ -160,7 +160,10 @@ func Demo(roomid ...int) {
                                }
                        }
                }
-                       
+               
+               //api
+               api := F.New_api(c.Roomid)
+
                //命令行操作 切换房间 发送弹幕
                go F.Cmd()
                //兑换硬币
@@ -175,7 +178,7 @@ func Demo(roomid ...int) {
                for !exit_sign {
                        danmulog.L(`T: `,"准备")
                        //获取房间相关信息
-                       api := F.New_api(c.Roomid).Get_host_Token().Get_live()
+                       api.Get_info().Get_host_Token().Get_live()
                        c.Roomid = api.Roomid
                        //获取用户版本
                        api.Get_Version()