forked from botuniverse/go-libonebot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathonebot_comm.go
46 lines (41 loc) · 1.11 KB
/
onebot_comm.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
package libonebot
func (ob *OneBot) startCommMethods() {
ob.commClosersLock.Lock()
defer ob.commClosersLock.Unlock()
ob.startCommMethodsHTTP()
ob.startCommMethodsHTTPWebhook()
ob.startCommMethodsWS()
ob.startCommMethodsWSReverse()
}
func (ob *OneBot) startCommMethodsHTTP() {
if ob.Config.CommMethods.HTTP == nil {
return
}
for _, c := range ob.Config.CommMethods.HTTP {
ob.commClosers = append(ob.commClosers, commStartHTTP(c, ob))
}
}
func (ob *OneBot) startCommMethodsHTTPWebhook() {
if ob.Config.CommMethods.HTTPWebhook == nil {
return
}
for _, c := range ob.Config.CommMethods.HTTPWebhook {
ob.commClosers = append(ob.commClosers, commStartHTTPWebhook(c, ob))
}
}
func (ob *OneBot) startCommMethodsWS() {
if ob.Config.CommMethods.WS == nil {
return
}
for _, c := range ob.Config.CommMethods.WS {
ob.commClosers = append(ob.commClosers, commStartWS(c, ob))
}
}
func (ob *OneBot) startCommMethodsWSReverse() {
if ob.Config.CommMethods.WSReverse == nil {
return
}
for _, c := range ob.Config.CommMethods.WSReverse {
ob.commClosers = append(ob.commClosers, commStartWSReverse(c, ob))
}
}