-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathevent.go
46 lines (36 loc) · 1.54 KB
/
event.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 go_ts3
import (
"time"
)
type TeamspeakEvent string
//noinspection GoUnusedConst
const (
NotifyTextMessage TeamspeakEvent = "notifytextmessage"
NotifyClientEnterView TeamspeakEvent = "notifycliententerview"
NotifyClientLeftView TeamspeakEvent = "notifyclientleftview"
NotifyServerEdited TeamspeakEvent = "notifyserveredited"
NotifyChannelEdited TeamspeakEvent = "notifychanneledited"
NotifyChannelDescriptionChanged TeamspeakEvent = "notifychanneldescriptionchanged"
NotifyClientMoved TeamspeakEvent = "notifyclientmoved"
NotifyChannelCreated TeamspeakEvent = "notifychannelcreated"
NotifyChannelDeleted TeamspeakEvent = "notifychanneldeleted"
NotifyChannelMoved TeamspeakEvent = "notifychannelmoved"
NotifyChannelPasswordChanged TeamspeakEvent = "notifychannelpasswordchanged"
NotifyTokenUsed TeamspeakEvent = "notifytokenused"
)
func (c *TeamspeakHttpClient) StartEventClient(host, user, password string) error {
client, err := newEventClient(host, user, password, c.eventBus)
if err != nil {
return err
}
time.Sleep(2 * time.Second)
_ = client.SwitchServer(c.serverID)
c.eventClient = client
return nil
}
func (c *TeamspeakHttpClient) SubscribeEvent(event TeamspeakEvent, fn interface{}) error {
return c.eventBus.Subscribe(string(event), fn)
}
func (c *TeamspeakHttpClient) UnsubscribeEvent(event TeamspeakEvent, handler interface{}) error {
return c.eventBus.Unsubscribe(string(event), handler)
}