-
Notifications
You must be signed in to change notification settings - Fork 2
/
server.go
79 lines (67 loc) · 2.3 KB
/
server.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
package revoltgo
import (
"time"
)
// Server holds information about a server.
type Server struct {
ID string `json:"_id"`
Owner string `json:"owner"`
Name string `json:"name"`
Description string `json:"description"`
Channels []string `json:"channels"`
Categories []*ServerCategory `json:"categories"`
SystemMessages ServerSystemMessages `json:"system_messages"`
// Roles is a map of role ID to ServerRole structs.
Roles map[string]*ServerRole `json:"roles"`
DefaultPermissions *uint `json:"default_permissions"`
Icon *Attachment `json:"icon"`
Banner *Attachment `json:"banner"`
Flags *uint `json:"flags"`
NSFW *bool `json:"nsfw"`
Analytics *bool `json:"analytics"`
Discoverable *bool `json:"discoverable"`
}
type ServerRole struct {
Name string `json:"name"`
Permissions *PermissionAD `json:"permissions"`
Colour string `json:"colour"`
Hoist bool `json:"hoist"`
Rank int `json:"rank"`
}
// ServerCategory Server categories struct.
type ServerCategory struct {
ID string `json:"id"`
Title string `json:"title"`
Channels []string `json:"channels"`
}
// ServerSystemMessages System messages struct.
type ServerSystemMessages struct {
UserJoined string `json:"user_joined,omitempty"`
UserLeft string `json:"user_left,omitempty"`
UserKicked string `json:"user_kicked,omitempty"`
UserBanned string `json:"user_banned,omitempty"`
}
type ServerMember struct {
ID MemberCompositeID `json:"_id"`
JoinedAt time.Time `json:"joined_at"`
Nickname *string `json:"nickname"`
Avatar *Attachment `json:"avatar"`
Roles []string `json:"roles"`
Timeout *time.Time `json:"timeout"`
}
type MemberCompositeID struct {
User string `json:"user"`
Server string `json:"server"`
}
type ServerMembers struct {
Members []*ServerMember `json:"members"`
Users []*User `json:"users"`
}
type ServerBans struct {
Users []*User `json:"users"`
Bans []*ServerBan `json:"bans"`
}
type ServerBan struct {
ID MemberCompositeID `json:"_id"`
Reason string `json:"reason"`
}