Documentation
¶
Index ¶
- Variables
- type APIAnalyticsResult
- type APIConfigurationResponse
- type APIConfigurationResponseManager
- type APIConfigurationResponseShard
- type APIConfigurationResponseShardGroup
- type APIMe
- type APIStatusManager
- type APIStatusResult
- type APIStatusShard
- type APIStatusShardGroup
- type APISubscribeResult
- type BaseResponse
- type DataStamp
- type Dataset
- type DiscordUser
- type LineChart
- type ManagerInformation
- type MessagingStatusUpdate
- type RPCManagerCreateEvent
- type RPCManagerDeleteEvent
- type RPCManagerRefreshGatewayEvent
- type RPCManagerRestartEvent
- type RPCManagerShardGroupCreateEvent
- type RPCManagerShardGroupDeleteEvent
- type RPCManagerShardGroupStopEvent
- type RPCRequest
- type RestTunnelAliveResponse
- type SandwichMetadata
- type SandwichPayload
- type ShardGroupStatus
- type ShardStatus
- type StateResult
- type TooManyRequests
Constants ¶
This section is empty.
Variables ¶
var LineChartColours = [][]string{
{"rgba(149, 165, 165, 0.5)", "#7E8C8D"},
{"rgba(236, 240, 241, 0.5)", "#BEC3C7"},
{"rgba(232, 76, 61, 0.5)", "#C1392B"},
{"rgba(231, 126, 35, 0.5)", "#D25400"},
{"rgba(241, 196, 15, 0.5)", "#F39C11"},
{"rgba(52, 73, 94, 0.5)", "#2D3E50"},
{"rgba(155, 88, 181, 0.5)", "#8F44AD"},
{"rgba(53, 152, 219, 0.5)", "#2A80B9"},
{"rgba(45, 204, 112, 0.5)", "#27AE61"},
{"rgba(27, 188, 155, 0.5)", "#16A086"},
}
Functions ¶
This section is empty.
Types ¶
type APIAnalyticsResult ¶
type APIAnalyticsResult struct {
Graph LineChart `json:"chart"`
Guilds int64 `json:"guilds"`
Channels int64 `json:"channels"`
Users int64 `json:"users"`
Members int64 `json:"members"`
Emojis int64 `json:"emojis"`
Uptime string `json:"uptime"`
Events int64 `json:"events"`
Managers []ManagerInformation `json:"managers"`
}
APIAnalyticsResult is the structure of the /api/analytics request.
type APIConfigurationResponse ¶
type APIConfigurationResponse struct {
Start time.Time `json:"uptime"`
Configuration interface{} `json:"configuration"`
RestTunnelEnabled bool `json:"rest_tunnel_enabled"`
MQDrivers []string `json:"mq_drivers"`
Version string `json:"version"`
}
APIConfigurationResponse is the structure of the thread safe /api/configuration endpoint.
type APIConfigurationResponseManager ¶
type APIConfigurationResponseManager struct {
ShardGroups map[int32]APIConfigurationResponseShardGroup `json:"shard_groups"`
Configuration interface{} `json:"configuration"`
Gateway interface{} `json:"gateway"`
Error string `json:"error"`
}
APIConfigurationResponseManager is the structure of the manager in the /api/configuration endpoint.
type APIConfigurationResponseShard ¶
type APIConfigurationResponseShard struct {
ShardID int `json:"shard_id"`
Retries int32 `json:"retries"`
Status ShardStatus `json:"status"`
HeartbeatInterval time.Duration `json:"heartbeat_interval"`
MaxHeartbeatFailures time.Duration `json:"max_heartbeat_failures"`
LastHeartbeatAck time.Time `json:"last_heartbeat_ack"`
LastHeartbeatSent time.Time `json:"last_heartbeat_sent"`
Start time.Time `json:"start"`
User *discord.User `json:"user"`
}
APIConfigurationResponseShard is the structure of a shard in the /api/configuration endpoint.
type APIConfigurationResponseShardGroup ¶
type APIConfigurationResponseShardGroup struct {
Status ShardGroupStatus `json:"status"`
Error string `json:"error"`
Start time.Time `json:"uptime"`
WaitingFor int32 `json:"waiting_for"`
ID int32 `json:"id"`
ShardCount int `json:"shard_count"`
ShardIDs []int `json:"shard_ids"`
Shards map[int]interface{} `json:"shards"`
}
APIConfigurationResponseShardGroup is the structure of a shardgroup in the /api/configuration endpoint.
type APIMe ¶
type APIMe struct {
Authenticated bool `json:"authenticated"`
User *DiscordUser `json:"user"`
}
APIMe is the response payload for a /api/me request.
type APIStatusManager ¶
type APIStatusManager struct {
DisplayName string `json:"name"`
Guilds int64 `json:"guilds"`
ShardGroups []APIStatusShardGroup `json:"shard_groups"`
}
APIStatusManager is the structure of a manager.
type APIStatusResult ¶
type APIStatusResult struct {
Managers []APIStatusManager `json:"managers"`
Uptime int64 `json:"uptime"`
}
APIStatusResult is the main /api/status body where both the managers and its uptime is handled.
type APIStatusShard ¶
type APIStatusShard struct {
Status ShardStatus `json:"status"`
Latency int64 `json:"latency"`
Uptime int64 `json:"uptime"`
}
APIStatusShard is the structure of a shard.
type APIStatusShardGroup ¶
type APIStatusShardGroup struct {
ID int32 `json:"id"`
Status ShardGroupStatus `json:"status"`
Shards []APIStatusShard `json:"shards"`
}
APIStatusShardGroup is the structure of a shardgroup.
type APISubscribeResult ¶
type APISubscribeResult struct {
Managers map[string]APIConfigurationResponseManager `json:"managers"`
RestTunnel jsoniter.RawMessage `json:"resttunnel"`
Analytics APIAnalyticsResult `json:"analytics"`
Start time.Time `json:"uptime"`
RestTunnelEnabled bool `json:"rest_tunnel_enabled"`
Waiting int64 `json:"waiting"`
}
APISubscribeResult is the structure of the websocket payloads.
type BaseResponse ¶
type BaseResponse struct {
Success bool `json:"success"`
Data interface{} `json:"data,omitempty"`
Error string `json:"error,omitempty"`
}
BaseResponse is the response when returning REST requests and RPC calls.
type DataStamp ¶
type DataStamp struct {
Time interface{} `json:"x"`
Value interface{} `json:"y"`
}
DataStamp stores time and its corresponding value.
type Dataset ¶
type Dataset struct {
Label string `json:"label"`
BackgroundColour string `json:"backgroundColor,omitempty"`
BorderColour string `json:"borderColor,omitempty"`
Data []interface{} `json:"data"`
}
Dataset is stores the representation of a Dataset in ChartJS.
type DiscordUser ¶
type DiscordUser struct {
ID snowflake.ID `json:"id" msgpack:"id"`
Username string `json:"username" msgpack:"username"`
Discriminator string `json:"discriminator" msgpack:"discriminator"`
Avatar string `json:"avatar" msgpack:"avatar"`
Locale string `json:"locale,omitempty" msgpack:"locale,omitempty"`
Email string `json:"email,omitempty" msgpack:"email,omitempty"`
Flags int `json:"flags" msgpack:"flags"`
PremiumType int `json:"premium_type" msgpack:"premium_type"`
MFAEnabled bool `json:"mfa_enabled,omitempty" msgpack:"mfa_enabled,omitempty"`
Verified bool `json:"verified,omitempty" msgpack:"verified,omitempty"`
}
DiscordUser is the structure of a /users/@me request.
type LineChart ¶
type LineChart struct {
Labels []string `json:"labels,omitempty"`
Datasets []Dataset `json:"datasets"`
}
LineChart stores the data structure for a ChartJS LineChart.
type ManagerInformation ¶
type ManagerInformation struct {
Name string `json:"name"`
Guilds int64 `json:"guilds"`
Status map[int32]ShardGroupStatus `json:"status"`
AutoStart bool `json:"autostart"`
}
ManagerInformation is the structure of the manager in the /api/analytics request.
type MessagingStatusUpdate ¶
type MessagingStatusUpdate struct {
ShardID int `msgpack:"shard,omitempty"`
Status int32 `msgpack:"status"`
}
MessagingStatusUpdate represents a shard status update.
type RPCManagerCreateEvent ¶
type RPCManagerCreateEvent struct {
Persist bool `json:"persist"`
Identifier string `json:"identifier"`
Token string `json:"token"`
Prefix string `json:"prefix"`
Client string `json:"client"`
Channel string `json:"channel"`
}
RPCManagerCreateEvent is the data structure of a RPCManagerCreate request.
type RPCManagerDeleteEvent ¶
type RPCManagerDeleteEvent struct {
Manager string `json:"manager"`
Confirm string `json:"confirm"`
}
RPCManagerDeleteEvent is the data structure of a RPCManagerDelete request.
type RPCManagerRefreshGatewayEvent ¶
type RPCManagerRefreshGatewayEvent struct {
Manager string `json:"manager"`
}
RPCManagerRefreshGatewayEvent is the data structure of a RPCManagerRefreshGateway request.
type RPCManagerRestartEvent ¶
type RPCManagerRestartEvent struct {
Manager string `json:"manager"`
Confirm string `json:"confirm"`
}
RPCManagerRestartEvent is the data structure of a RPCManagerRestart request.
type RPCManagerShardGroupCreateEvent ¶
type RPCManagerShardGroupCreateEvent struct {
Manager string `json:"manager"`
RawShardIDs string `json:"shardIDs"`
ShardCount int `json:"shardCount"`
ShardIDs []int `json:"finalShardIDs"`
AutoIDs bool `json:"autoIDs"`
AutoShard bool `json:"autoShard"`
StartImmediately bool `json:"startImmediately"`
}
RPCManagerShardGroupCreateEvent is the data structure of a RPCManagerShardGroupCreate request.
type RPCManagerShardGroupDeleteEvent ¶
type RPCManagerShardGroupDeleteEvent struct {
Manager string `json:"manager"`
ShardGroup int32 `json:"shardgroup"`
}
RPCManagerShardGroupDeleteEvent is the data structure of a RPCManagerShardGroupDelete request.
type RPCManagerShardGroupStopEvent ¶
type RPCManagerShardGroupStopEvent struct {
Manager string `json:"manager"`
ShardGroup int32 `json:"shardgroup"`
}
RPCManagerShardGroupStopEvent is the data structure of a RPCManagerShardGroupStop request.
type RPCRequest ¶
type RPCRequest struct {
Method string `json:"method"`
Data jsoniter.RawMessage `json:"data"`
}
RPCRequest is the structure the client sends when an RPC call is made.
type RestTunnelAliveResponse ¶
type RestTunnelAliveResponse struct {
Success bool `json:"success"`
Data struct {
Name string `json:"name"`
Version string `json:"version"`
Reverse bool `json:"reverse"`
} `json:"data"`
}
RestTunnelAliveResponse the RestTunnel alive response payload.
type SandwichMetadata ¶
type SandwichMetadata struct {
Version string `json:"v" msgpack:"v"`
Identifier string `json:"i" msgpack:"i"`
Shard [3]int `json:"s,omitempty" msgpack:"s,omitempty"` // ShardGroup ID, Shard ID, Shard Count
}
SandwichMetadata represents the identification information that consumers will use.
type SandwichPayload ¶
type SandwichPayload struct {
discord.ReceivedPayload
Data interface{} `json:"d,omitempty" msgpack:"d,omitempty"`
Extra map[string]interface{} `json:"e,omitempty" msgpack:"e,omitempty"`
Metadata SandwichMetadata `json:"__sandwich" msgpack:"__sandwich"`
Trace map[string]int `json:"__trace,omitempty" msgpack:"__trace,omitempty"`
}
SandwichPayload represents the data that is sent to consumers.
type ShardGroupStatus ¶
type ShardGroupStatus int32
ShardGroupStatus represents a shardgroups status.
const ( ShardGroupIdle ShardGroupStatus = iota // Represents a ShardGroup that has been created but not opened yet ShardGroupStarting // Represent a ShardGroup that is still starting up clients (connecting to gateway) ShardGroupConnecting // Represents a ShardGroup that has successfully connected to gateway and is waiting for chunking to finish ShardGroupReady // Represent a ShardGroup that has all its shards ready ShardGroupReplaced // Represent a ShardGroup that is going to be replaced soon by a new ShardGroup ShardGroupClosing // Represent a ShardGroup in the process of closing ShardGroupClosed // Represent a closed ShardGroup ShardGroupError // Represents a closed ShardGroup that closed unexpectedly due to an error )
Status Codes for ShardGroups.
type ShardStatus ¶
type ShardStatus int32
ShardStatus represents the shard status.
const ( ShardIdle ShardStatus = iota // Represents a Shard that has been created but not opened yet ShardWaiting // Represents a Shard waiting for the identify ratelimit ShardConnecting // Represents a Shard connecting to the gateway ShardConnected // Represents a Shard that has connected to discords gateway ShardReady // Represents a Shard that has finished lazy loading ShardReconnecting // Represents a Shard that is reconnecting ShardClosed // Represents a Shard that has been closed )
Status Codes for Shard.
func (*ShardStatus) Colour ¶
func (ss *ShardStatus) Colour() int
func (*ShardStatus) String ¶
func (ss *ShardStatus) String() string
type StateResult ¶
type StateResult struct {
Data interface{}
Extra map[string]interface{}
}
StateResult represents the data a state handler would return which would be converted to a sandwich payload.
type TooManyRequests ¶
type TooManyRequests struct {
Message string `json:"message" msgpack:"message"`
RetryAfter int `json:"retry_after" msgpack:"retry_after"`
Global bool `json:"global" msgpack:"global"`
}
TooManyRequests represents the payload of a TooManyRequests response.