-
Notifications
You must be signed in to change notification settings - Fork 0
/
QuequeUtils.go
71 lines (61 loc) · 1.83 KB
/
QuequeUtils.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package main
import (
"github.com/vtb-link/bianka/proto"
"strings"
)
func ResponseQueCtrl(DmParsed *proto.CmdDanmuData) {
//DmParsed := <-DanmuDataChan
if globalConfiguration.EnableMusicServer {
if strings.HasPrefix(DmParsed.Msg, "点歌 ") {
SendMusicServer("search", DmParsed.Msg[7:])
}
}
SendDmToWs(DmParsed)
// 用户发送取消排队指令响应
if DmParsed.Msg == "取消排队" {
// DeleteLine(strconv.Itoa(DmParsed.Uid))
DeleteLine(DmParsed.OpenID)
}
// 用户发送寻址指令响应
if DmParsed.Msg == "我在哪" {
SendWhereToWs(DmParsed.OpenID)
}
// 用户发送关键词响应
if !KeyWordMatchMap[DmParsed.Msg] {
return
}
// openID := strconv.Itoa(DmParsed.Uid)
openID := DmParsed.OpenID
if line.GuardIndex[openID] != 0 || line.GiftIndex[openID] != 0 || line.CommonIndex[openID] != 0 {
return
}
switch {
// 用户为舰长或提督
case DmParsed.GuardLevel <= 3 && DmParsed.GuardLevel != 0:
lineTemp := Line{
// OpenID: DmParsed.OpenID,
OpenID: openID,
UserName: DmParsed.Uname,
Avatar: DmParsed.UFace,
PrintColor: globalConfiguration.GuardPrintColor,
}
line.GuardLine = append(line.GuardLine, lineTemp)
//line.GuardIndex[DmParsed.OpenID] = len(line.GuardLine)
line.GuardIndex[openID] = len(line.GuardLine)
SendLineToWs(lineTemp, GiftLine{}, GuardLineType)
SetLine(line)
case len(line.CommonLine) <= globalConfiguration.MaxLineCount:
lineTemp := Line{
// OpenID: DmParsed.OpenID,
OpenID: openID,
UserName: DmParsed.Uname,
Avatar: DmParsed.UFace,
PrintColor: globalConfiguration.CommonPrintColor,
}
line.CommonLine = append(line.CommonLine, lineTemp)
//line.CommonIndex[DmParsed.OpenID] = len(line.CommonLine)
line.CommonIndex[openID] = len(line.CommonLine)
SendLineToWs(lineTemp, GiftLine{}, CommonLineType)
SetLine(line)
}
}