From: qydysky Date: Tue, 16 Mar 2021 12:00:45 +0000 (+0800) Subject: 在发送礼物前先获取主播uid X-Git-Tag: v0.5.8~1^2~12 X-Git-Url: http://127.0.0.1:8081/?a=commitdiff_plain;h=dbe359233a2f1c66c673e7e2725bd9035fa5f043;p=bili_danmu%2F.git 在发送礼物前先获取主播uid --- diff --git a/Send/Send_gift.go b/Send/Send_gift.go index 8976287..4e68b53 100644 --- a/Send/Send_gift.go +++ b/Send/Send_gift.go @@ -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} diff --git a/bili_danmu.go b/bili_danmu.go index 91f0c18..df49c05 100644 --- a/bili_danmu.go +++ b/bili_danmu.go @@ -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()