Class string
Data interface{}
}
-var Danmu_Main_mq = mq.New(10)
+//200长度防止push击穿
+var Danmu_Main_mq = mq.New(200)
//日志
var Log = log.New(log.Config{
- [github.com/christopher-dG/go-obs-websocket](https://github.com/christopher-dG/go-obs-websocket) under [MIT](https://raw.githubusercontent.com/christopher-dG/go-obs-websocket/master/LICENSE)
- [github.com/gorilla/websocket](https://github.com/gorilla/websocket) under [BSD 2-Clause](https://raw.githubusercontent.com/gorilla/websocket/master/LICENSE)
- [github.com/skip2/go-qrcode](https://github.com/skip2/go-qrcode) under [MIT](https://github.com/skip2/go-qrcode/blob/master/LICENSE)
+- [github.com/gofrs/uuid](https://github.com/gofrs/uuid) under [MIT](https://github.com/gofrs/uuid/blob/master/LICENSE)
- [7z](https://www.7-zip.org/) under [LICENSE](https://www.7-zip.org/license.txt)
---
#### 当前支持功能
以下内容可能过时,点击查看[当前支持功能](https://github.com/qydysky/bili_danmu/blob/master/Reply/F.go#L16)
+- [x] 自定义私信
- [x] 自动切换粉丝牌
- [x] 扫码登录
- [x] 自定义语音提醒
|-|-|
|./|弹幕发送|
|Send.go|弹幕发送|
+|Send_pm.go|私信发送|
---
\ No newline at end of file
var pm_limit = p.Limit(1, 5000, 10000)
func Send_pm(uid int, msg string) error {
- if pm_limit.TO() {return errors.New("TO")}
- log := c.Log.Base_add(`私信`)
-
if msg == `` || uid == 0 {
return errors.New(`msg == "" || uid == 0`)
}
+ log := c.Log.Base_add(`私信`)
+
if c.Uid == 0 {
log.L(`E: `,`client uid == 0`)
return errors.New(`client uid == 0`)
}
}
+ if pm_limit.TO() {return errors.New("TO")}
+
var send_str = `msg[sender_uid]=`+strconv.Itoa(c.Uid)+`&msg[receiver_id]=`+strconv.Itoa(uid)+`&msg[receiver_type]=1&msg[msg_type]=1&msg[msg_status]=0&msg[content]={"content":"`+msg+`"}&msg[timestamp]=`+strconv.Itoa(int(p.Sys().GetSTime()))+`&msg[new_face_version]=0&msg[dev_id]=`+strings.ToUpper(new_uuid)+`&from_firework=0&build=0&mobi_app=web&csrf_token=`+csrf+`&csrf=`+csrf
req := p.Req()
if _,ok := c.Default_qn[*live_qn]; ok{c.Live_qn = *live_qn}
var exit_sign bool
- var change_room_chan = make(chan bool,1)
+ var change_room_chan = make(chan struct{})
go func(){
var room = *groomid
}
if c.Roomid == 0 {
c.Roomid = room
- change_room_chan <- true
+ change_room_chan <- struct{}{}
}
}()
c.Uname = ``//主播id
c.Title = ``
reply.Saveflv_wait()//停止保存直播流
- change_room_chan <- true
+ for len(change_room_chan) != 0 {<-change_room_chan}
+ change_room_chan <- struct{}{}
return false
},
`c.Rev_add`:func(data interface{})(bool){//收入
interrupt <- os.Interrupt
return false
},
+ })
+ //单独,避免队列执行耗时block从而无法接收更多消息
+ c.Danmu_Main_mq.Pull_tag(map[string]func(interface{})(bool){
`pm`:func(data interface{})(bool){//私信
if tmp,ok := data.(send.Pm_item);ok{
send.Send_pm(tmp.Uid,tmp.Msg)
|config_disable_msg.json|禁用消息开关|
|config_gtk_keep_key.json|gtk醒目提示时长|
|config_tts.json|语音提示模板|
+|config_K_v.json|Key-value键值设置|
---
\ No newline at end of file
|0room|房间消息时的头像|
|0superchat|醒目留言时显示的头像|
|0tianxuan|天选之人消息时显示的头像|
+|0multi|多人消息时显示的头像|
---
\ No newline at end of file
github.com/miekg/dns v1.1.35 // indirect
github.com/mitchellh/mapstructure v1.4.0 // indirect
github.com/qydysky/bili_danmu v0.5.7
- github.com/qydysky/part v0.3.5-0.20201228170623-c701da7df342 // indirect
+ github.com/qydysky/part v0.3.5-0.20210105160037-508c706d691b // indirect
github.com/shirou/gopsutil v3.20.12+incompatible // indirect
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e // indirect
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad // indirect
replace (
github.com/gotk3/gotk3 v0.5.2 => github.com/qydysky/gotk3 v0.0.0-20210103171910-327affdaaa80
github.com/qydysky/bili_danmu => ../
+//github.com/qydysky/part => ../../part
)
github.com/qydysky/part v0.3.5-0.20201228153342-9ad523c2bef4/go.mod h1:SxxNav0Z7DbsDLoG5uxo0wW5EKU/JBu2CAkZzZeLnX0=
github.com/qydysky/part v0.3.5-0.20201228170623-c701da7df342 h1:7wCI40bHHgJ9+yByTqvLM7Jctz9Z5oMoK2AATHBHxaQ=
github.com/qydysky/part v0.3.5-0.20201228170623-c701da7df342/go.mod h1:SxxNav0Z7DbsDLoG5uxo0wW5EKU/JBu2CAkZzZeLnX0=
+github.com/qydysky/part v0.3.5-0.20210105160037-508c706d691b h1:rKR4PD/8CzT28Whf4ILQ4WZZW1S8MxJFSluYtrzu5+c=
+github.com/qydysky/part v0.3.5-0.20210105160037-508c706d691b/go.mod h1:SxxNav0Z7DbsDLoG5uxo0wW5EKU/JBu2CAkZzZeLnX0=
github.com/qydysky/part/msgq v0.0.0-20201213031129-ca3253dc72ad h1:Jtzf509lQrkUMGTV0Sc6IDCAiR1VrBcHrIban7hpye4=
github.com/qydysky/part/msgq v0.0.0-20201213031129-ca3253dc72ad/go.mod h1:w32TkJNVtTJd4LOS09cq+4uYG6itcN2vsqw+slp44Rg=
github.com/qydysky/part/msgq v0.0.0-20201213120821-f36e49c32bba h1:1ew9dRpc0Rux0WkWeT/4AE15ynYWmL2D7onJEJIFOB8=
package main
import (
+ // "os"
+ // "runtime/pprof"
q "github.com/qydysky/bili_danmu"
)
func main() {
+ // f, _ := os.OpenFile("cpu.pprof", os.O_RDWR|os.O_CREATE, 0644)
+ // pprof.StartCPUProfile(f)
+
q.Demo()
+
+ // pprof.StopCPUProfile()
+ // f.Close()
}
\ No newline at end of file