Documentation
¶
Index ¶
- func ScoreKindFromDTO(clientScoreKind *string, gameType string) string
- type ByMessageTargetIDs
- type ByPlayerCountNotificationIDs
- type ChangedServerStatus
- type Channel
- type ChannelTarget
- type Channels
- type Client
- type ClientStatus
- func (cs *ClientStatus) ClanLen() int
- func (cs *ClientStatus) Equals(other *ClientStatus) bool
- func (cs *ClientStatus) Format(namePadding, clanPadding int, scoreKind string) string
- func (cs *ClientStatus) FormatClan(padding int) string
- func (cs *ClientStatus) FormatName(padding int) string
- func (cs *ClientStatus) FormatScore(scoreKind string) string
- func (c *ClientStatus) IsBot() bool
- func (c *ClientStatus) IsSpectator() bool
- func (cs *ClientStatus) NameLen() int
- func (c *ClientStatus) TeamID() int16
- func (cs *ClientStatus) ToEmbedFields(namePadding, clanPadding int, scoreKind string) (fields []discord.EmbedField, charLen int)
- type ClientStatusList
- func (c ClientStatusList) Equals(other ClientStatusList) bool
- func (clients ClientStatusList) Format(namePadding, clanPadding int, scoreKind string) string
- func (clients ClientStatusList) Iterate(scoreKind string, f func(idx int, client ClientStatus) bool)
- func (clients ClientStatusList) ToEmbedList(color discord.Color, namePadding, clanPadding int, scoreKind string) []discord.Embed
- type Flag
- type FlagMapping
- type FlagMappings
- type Guild
- type Guilds
- type Mentions
- type MessageMentions
- type MessageTarget
- type MessageUserTarget
- type Part
- type PlayerCountNotification
- type PlayerCountNotifications
- type Server
- type ServerStatus
- func (ss *ServerStatus) AddClientStatus(client ClientStatus)
- func (ss *ServerStatus) Equals(other ServerStatus) bool
- func (s *ServerStatus) HasV6Protocol() bool
- func (ss ServerStatus) Header() string
- func (ss ServerStatus) NameToQuickJoinUrl() string
- func (s *ServerStatus) ProtocolsFromJSON(data []byte) error
- func (s *ServerStatus) ProtocolsJSON() []byte
- func (ss ServerStatus) String() string
- func (ss ServerStatus) ToEmbeds() []discord.Embed
- func (ss *ServerStatus) TotalTeams() int
- type Skin
- type Tracking
- type Trackings
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ScoreKindFromDTO ¶
Types ¶
type ByMessageTargetIDs ¶
type ByMessageTargetIDs []MessageTarget
func (ByMessageTargetIDs) Len ¶
func (a ByMessageTargetIDs) Len() int
func (ByMessageTargetIDs) Less ¶
func (a ByMessageTargetIDs) Less(i, j int) bool
func (ByMessageTargetIDs) Swap ¶
func (a ByMessageTargetIDs) Swap(i, j int)
type ByPlayerCountNotificationIDs ¶
type ByPlayerCountNotificationIDs []PlayerCountNotification
func (ByPlayerCountNotificationIDs) Len ¶
func (a ByPlayerCountNotificationIDs) Len() int
func (ByPlayerCountNotificationIDs) Less ¶
func (a ByPlayerCountNotificationIDs) Less(i, j int) bool
func (ByPlayerCountNotificationIDs) Swap ¶
func (a ByPlayerCountNotificationIDs) Swap(i, j int)
type ChangedServerStatus ¶
type ChangedServerStatus struct {
Target MessageTarget
Prev ServerStatus
Curr ServerStatus
Offline bool
UserNotifications []discord.UserID
}
func (*ChangedServerStatus) Content ¶
func (c *ChangedServerStatus) Content() string
type ChannelTarget ¶
func (ChannelTarget) Less ¶
func (a ChannelTarget) Less(other ChannelTarget) bool
type Client ¶
type Client struct {
Name string `json:"name"`
Clan string `json:"clan"`
Country int16 `json:"country"`
Score int32 `json:"score"`
IsPlayer bool `json:"is_player"`
Skin *Skin `json:"skin,omitempty"`
Afk *bool `json:"afk,omitempty"`
Team *int16 `json:"team,omitempty"`
}
func ClientFromDTO ¶
func (*Client) IsConnecting ¶
func (*Client) IsPlayerInt64 ¶
type ClientStatus ¶
type ClientStatus struct {
Name string
Clan string
Country int16
Score int32
IsPlayer bool
Team *int16
FlagAbbr string
FlagEmoji string // mapped emoji
}
func (*ClientStatus) ClanLen ¶
func (cs *ClientStatus) ClanLen() int
func (*ClientStatus) Equals ¶
func (cs *ClientStatus) Equals(other *ClientStatus) bool
func (*ClientStatus) Format ¶
func (cs *ClientStatus) Format(namePadding, clanPadding int, scoreKind string) string
func (*ClientStatus) FormatClan ¶
func (cs *ClientStatus) FormatClan(padding int) string
func (*ClientStatus) FormatName ¶
func (cs *ClientStatus) FormatName(padding int) string
func (*ClientStatus) FormatScore ¶
func (cs *ClientStatus) FormatScore(scoreKind string) string
func (*ClientStatus) IsBot ¶
func (c *ClientStatus) IsBot() bool
func (*ClientStatus) IsSpectator ¶
func (c *ClientStatus) IsSpectator() bool
func (*ClientStatus) NameLen ¶
func (cs *ClientStatus) NameLen() int
func (*ClientStatus) TeamID ¶
func (c *ClientStatus) TeamID() int16
func (*ClientStatus) ToEmbedFields ¶
func (cs *ClientStatus) ToEmbedFields(namePadding, clanPadding int, scoreKind string) (fields []discord.EmbedField, charLen int)
type ClientStatusList ¶
type ClientStatusList []ClientStatus
func (ClientStatusList) Equals ¶
func (c ClientStatusList) Equals(other ClientStatusList) bool
func (ClientStatusList) Format ¶
func (clients ClientStatusList) Format(namePadding, clanPadding int, scoreKind string) string
func (ClientStatusList) Iterate ¶
func (clients ClientStatusList) Iterate(scoreKind string, f func(idx int, client ClientStatus) bool)
The index that is passed to the must not be assumed to be the current position in the list. Depending on the scoreKind, the iteration might happend in reverse while the index is still increasing.
func (ClientStatusList) ToEmbedList ¶
type FlagMapping ¶
type FlagMapping struct {
GuildID discord.GuildID
ChannelID discord.ChannelID
FlagID int16
Abbr string
Emoji string
}
func (*FlagMapping) String ¶
func (f *FlagMapping) String() string
type FlagMappings ¶
type FlagMappings []FlagMapping
func (FlagMappings) String ¶
func (f FlagMappings) String() string
type MessageMentions ¶
type MessageMentions map[MessageTarget]Mentions
type MessageTarget ¶
type MessageTarget struct {
ChannelTarget
MessageID discord.MessageID
}
func (*MessageTarget) Equals ¶
func (t *MessageTarget) Equals(other MessageTarget) bool
func (MessageTarget) Less ¶
func (a MessageTarget) Less(other MessageTarget) bool
func (MessageTarget) String ¶
func (t MessageTarget) String() string
type MessageUserTarget ¶
type MessageUserTarget struct {
MessageTarget
UserID discord.UserID
}
type Part ¶
func PartFromDTO ¶
type PlayerCountNotification ¶
type PlayerCountNotification struct {
MessageUserTarget
Threshold int
}
func (PlayerCountNotification) Notify ¶
func (p PlayerCountNotification) Notify(change *ChangedServerStatus) bool
type PlayerCountNotifications ¶
type PlayerCountNotifications []PlayerCountNotification
type Server ¶
type Server struct {
Timestamp time.Time
Address string
Protocols []string
Name string
Gametype string
Passworded bool
Map string
MapSha256Sum *string
MapSize *int32
Version string
MaxClients int16
MaxPlayers int16
ScoreKind string
Clients []Client // serialized as json into database
}
func NewServersFromDTO ¶
expands the servers.Server DTO into a slice of Server models
func (*Server) ProtocolsFromJSON ¶
func (*Server) ProtocolsJSON ¶
type ServerStatus ¶
type ServerStatus struct {
Timestamp time.Time // not used for equality checks
Address string
Protocols []string
Name string
Gametype string
Passworded bool
Map string
MapSha256Sum *string
MapSize *int32
Version string
MaxClients int16
MaxPlayers int16
ScoreKind string
Clients ClientStatusList
// not relevant for equality checks
// derived meta data
Spectators ClientStatusList
Teams map[int16]ClientStatusList
LongestName int
LongestClan int
NumPlayers int // not spectators
NumSpectators int
}
func (*ServerStatus) AddClientStatus ¶
func (ss *ServerStatus) AddClientStatus(client ClientStatus)
func (*ServerStatus) Equals ¶
func (ss *ServerStatus) Equals(other ServerStatus) bool
func (*ServerStatus) HasV6Protocol ¶
func (s *ServerStatus) HasV6Protocol() bool
func (ServerStatus) Header ¶
func (ss ServerStatus) Header() string
func (ServerStatus) NameToQuickJoinUrl ¶
func (ss ServerStatus) NameToQuickJoinUrl() string
func (*ServerStatus) ProtocolsFromJSON ¶
func (s *ServerStatus) ProtocolsFromJSON(data []byte) error
func (*ServerStatus) ProtocolsJSON ¶
func (s *ServerStatus) ProtocolsJSON() []byte
func (ServerStatus) String ¶
func (ss ServerStatus) String() string
func (ServerStatus) ToEmbeds ¶
func (ss ServerStatus) ToEmbeds() []discord.Embed
func (*ServerStatus) TotalTeams ¶
func (ss *ServerStatus) TotalTeams() int
type Skin ¶
type Skin struct {
Name *string `json:"name,omitempty"`
ColorBody *int32 `json:"color_body,omitempty"`
ColorFeet *int32 `json:"color_feet,omitempty"`
Body *Part `json:"body,omitempty"`
Marking *Part `json:"marking,omitempty"`
Decoration *Part `json:"decoration,omitempty"`
Hands *Part `json:"hands,omitempty"`
Feet *Part `json:"feet,omitempty"`
Eyes *Part `json:"eyes,omitempty"`
}
func SkinFromDTO ¶
type Tracking ¶
type Tracking struct {
MessageTarget
Address string // ipv4:port or [ipv6]:port
}
Tracking is a struct that represents a tracking message which contains a single server's status.
Click to show internal directories.
Click to hide internal directories.