]> 127.0.0.1 Git - bili_danmu/.git/commitdiff
Fix ws退出错误
authorqydysky <qydysky@foxmail.com>
Tue, 16 May 2023 17:55:39 +0000 (01:55 +0800)
committerqydysky <qydysky@foxmail.com>
Tue, 16 May 2023 17:56:03 +0000 (01:56 +0800)
F/api.go
bili_danmu.go
go.mod
go.sum

index e79be8a1b0b449a8743b5f6c16ad45cb02aa18be..8171966305de580f5dcc96563a81e8c16282ead9 100644 (file)
--- a/F/api.go
+++ b/F/api.go
@@ -139,10 +139,6 @@ func (c *GetFunc) Get(key string) {
                        `LIVE_BUVID`: { //LIVE_BUVID
                                c.Get_LIVE_BUVID,
                        },
-
-                       `Silver_2_coin`: { //银瓜子2硬币
-                               c.Silver_2_coin,
-                       },
                        `CheckSwitch_FansMedal`: { //切换粉丝牌
                                c.CheckSwitch_FansMedal,
                        },
@@ -209,9 +205,6 @@ func (c *GetFunc) Get(key string) {
                        `LIVE_BUVID`: func() bool { //LIVE_BUVID
                                return c.LiveBuvidUpdated.After(time.Now().Add(-time.Hour))
                        },
-                       `Silver_2_coin`: func() bool { //银瓜子2硬币
-                               return true
-                       },
                        `CheckSwitch_FansMedal`: func() bool { //切换粉丝牌
                                return true
                        },
index 2a10e87508d3efabe08197266847306fc865116c..c903300a3da9f182f3bfa97b36d01cd6f569854b 100644 (file)
@@ -48,18 +48,11 @@ func Start() {
                var interrupt = make(chan os.Signal, 2)
                //捕获ctrl+c退出
                signal.Notify(interrupt, os.Interrupt)
-               danmulog.L(`T: `, "3s内两次ctrl+c强制退出")
-               for {
-                       <-interrupt
-                       c.C.Danmu_Main_mq.PushLock_tag(`interrupt`, nil)
-                       select {
-                       case <-interrupt:
-                               c.C.Danmu_Main_mq.PushLock_tag(`interrupt`, nil)
-                               danmulog.L(`I: `, "强制退出!").Block(1000)
-                               os.Exit(1)
-                       case <-time.After(time.Second * 3):
-                       }
-               }
+               danmulog.L(`I: `, "ctrl+c退出")
+               <-interrupt
+               c.C.Danmu_Main_mq.PushLock_tag(`interrupt`, nil)
+               danmulog.L(`I: `, "退出!").Block(1000)
+               os.Exit(1)
        }()
 
        // 启动时显示ip
@@ -81,7 +74,7 @@ func Start() {
                //获取uid
                F.Get(c.C).Get(`Uid`)
                //兑换硬币
-               F.Get(c.C).Get(`Silver_2_coin`)
+               F.Get(c.C).Silver_2_coin()
                //每日签到
                F.Dosign()
                // 附加功能 savetojson
@@ -135,14 +128,13 @@ func Start() {
                })
 
                for exit_sign := true; exit_sign; {
-                       if len(change_room_chan) == 0 {
+                       if c.C.Roomid == 0 {
                                fmt.Println("回车查看指令")
-                       }
-
-                       select {
-                       case <-change_room_chan:
-                       case <-interrupt_chan:
-                               exit_sign = false
+                               select {
+                               case <-change_room_chan:
+                               case <-interrupt_chan:
+                                       exit_sign = false
+                               }
                        }
 
                        if !exit_sign {
diff --git a/go.mod b/go.mod
index 5cdf4859feb05b7fe0cda7ed7e6411dbc715acf2..905994e2938d5db82b4a525a2d9ef2731d96fb75 100644 (file)
--- a/go.mod
+++ b/go.mod
@@ -5,7 +5,7 @@ go 1.20
 require (
        github.com/gotk3/gotk3 v0.6.2
        github.com/mdp/qrterminal/v3 v3.0.0
-       github.com/qydysky/part v0.27.1
+       github.com/qydysky/part v0.27.3
        github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
        github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
        golang.org/x/text v0.9.0
diff --git a/go.sum b/go.sum
index 3b38bb35d4cff0c2ab0c59b0237167bf4f30f777..f9b2e09297a84254cd81b30a2b40e2bee116e3a7 100644 (file)
--- a/go.sum
+++ b/go.sum
@@ -31,8 +31,8 @@ github.com/mdp/qrterminal/v3 v3.0.0/go.mod h1:NJpfAs7OAm77Dy8EkWrtE4aq+cE6McoLXl
 github.com/miekg/dns v1.1.54 h1:5jon9mWcb0sFJGpnI99tOMhCPyJ+RPVz5b63MQG0VWI=
 github.com/miekg/dns v1.1.54/go.mod h1:uInx36IzPl7FYnDcMeVWxj9byh7DutNykX4G9Sj60FY=
 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
-github.com/qydysky/part v0.27.1 h1:syJqzbITS3TGmNMgqHPwR8eoJIK8REa8wbQubbUbldg=
-github.com/qydysky/part v0.27.1/go.mod h1:IEMpGB0NBl6MklZmoenSpS5ChhaIL79JYFo6mF1UkAU=
+github.com/qydysky/part v0.27.3 h1:mTh5o+wiwX47/e0aGQCU3Qr0QPNkZEN1yMgcD23fQXs=
+github.com/qydysky/part v0.27.3/go.mod h1:IEMpGB0NBl6MklZmoenSpS5ChhaIL79JYFo6mF1UkAU=
 github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
 github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
 github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=