From ce588b891edf2ff827583251b6f6f7027c9dce23 Mon Sep 17 00:00:00 2001 From: qydysky Date: Sat, 6 Mar 2021 08:39:51 +0800 Subject: [PATCH] =?utf8?q?=E5=91=BD=E4=BB=A4=E8=A1=8C=E4=B9=9F=E5=8F=AF?= =?utf8?q?=E5=88=87=E6=8D=A2=E6=88=BF=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- bili_danmu.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/bili_danmu.go b/bili_danmu.go index 21e9904..bf0960c 100644 --- a/bili_danmu.go +++ b/bili_danmu.go @@ -111,6 +111,22 @@ func Demo(roomid ...int) { <-change_room_chan + //命令行也可切换房间 + go func(){ + for input := ``; true; { + if _,err := fmt.Scanln(&input);err.Error() == `unexpected newline`{ + fmt.Println("输入房间号并回车(其他显示隔断不影响)\n") + room := 0 + if _,err := fmt.Scanln(&room);err != nil { + danmulog.L(`W: `, "房间输入错误", room, err) + } else { + c.Roomid = room + c.Danmu_Main_mq.Push_tag(`change_room`,nil) + } + } + } + }() + //ctrl+c退出 signal.Notify(interrupt, os.Interrupt) -- 2.39.2