-
Notifications
You must be signed in to change notification settings - Fork 19
/
const.go
103 lines (91 loc) · 2.33 KB
/
const.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
// Author: Niels A.D.
// Project: gowarcraft3 (https://github.com/nielsAD/gowarcraft3)
// License: Mozilla Public License, v2.0
package capi
import (
"fmt"
)
// CAPI command identifiers
const (
CmdRequestSuffix = "Request"
CmdResponseSuffix = "Response"
CmdAuthenticate = "Botapiauth.Authenticate"
CmdConnect = "Botapichat.Connect"
CmdDisconnect = "Botapichat.Disconnect"
CmdSendMessage = "Botapichat.SendMessage"
CmdSendEmote = "Botapichat.SendEmote"
CmdSendWhisper = "Botapichat.SendWhisper"
CmdKickUser = "Botapichat.KickUser"
CmdBanUser = "Botapichat.BanUser"
CmdUnbanUser = "Botapichat.UnbanUser"
CmdSetModerator = "Botapichat.SendSetModerator"
CmdConnectEvent = "Botapichat.ConnectEvent"
CmdDisconnectEvent = "Botapichat.DisconnectEvent"
CmdMessageEvent = "Botapichat.MessageEvent"
CmdUserUpdateEvent = "Botapichat.UserUpdateEvent"
CmdUserLeaveEvent = "Botapichat.UserLeaveEvent"
)
// MessageEventType enum
type MessageEventType uint32
// Message event types
const (
Unknown MessageEventType = iota
MessageWhisper
MessageChannel
MessageServerInfo
MessageServerError
MessageEmote
)
func (m MessageEventType) String() string {
switch m {
case MessageWhisper:
return "Whisper"
case MessageChannel:
return "Channel"
case MessageServerInfo:
return "ServerInfo"
case MessageServerError:
return "ServerError"
case MessageEmote:
return "Emote"
default:
return fmt.Sprintf("MessageEventType(0x%02X)", uint32(m))
}
}
// MarshalText implements TextMarshaler
func (m MessageEventType) MarshalText() ([]byte, error) {
return []byte(m.String()), nil
}
// UnmarshalText implements TextUnmarshaler
func (m *MessageEventType) UnmarshalText(txt []byte) error {
switch string(txt) {
case "Whisper":
*m = MessageWhisper
case "Channel":
*m = MessageChannel
case "ServerInfo":
*m = MessageServerInfo
case "ServerError":
*m = MessageServerError
case "Emote":
*m = MessageEmote
default:
*m = Unknown
}
return nil
}
// User flags
const (
UserFlagAdmin = "Admin"
UserFlagModerator = "Moderator"
UserFlagSpeaker = "Speaker"
UserFlagMuteGlobal = "MuteGlobal"
UserFlagMuteWhisper = "MuteWhisper"
)
// User attribute keys
const (
UserAttrProgramID = "ProgramId"
UserAttrRate = "Rate"
UserAttrRank = "Rank"
UserAttrWins = "Wins"
)