structs

package
v0.0.0-...-4a3f5b2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2024 License: MIT Imports: 4 Imported by: 3

Documentation

Index

Constants

View Source
const (
	SandwichEventConfigurationReload    = "SW_CONFIGURATION_RELOAD"
	SandwichEventShardStatusUpdate      = "SW_SHARD_STATUS_UPDATE"
	SandwichEventShardGroupStatusUpdate = "SW_SHARD_GROUP_STATUS_UPDATE"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseResponse

type BaseResponse struct {
	Version string `json:"version"`

	Ok    bool   `json:"ok"`
	Error string `json:"error"`
}

BaseResponse represents data included in all GRPC responses.

type BaseRestResponse

type BaseRestResponse struct {
	Ok    bool        `json:"ok"`
	Data  interface{} `json:"data,omitempty"`
	Error string      `json:"error,omitempty"`
}

type ChannelsResponse

type ChannelsResponse struct {
	BaseResponse
	GuildChannels map[int64]*discord.Channel
}

type CreateManagerArguments

type CreateManagerArguments struct {
	Identifier         string `json:"identifier"`
	ProducerIdentifier string `json:"producer_identifier"`
	FriendlyName       string `json:"friendly_name"`
	Token              string `json:"token"`
	ClientName         string `json:"client_name"`
	ChannelName        string `json:"channel_name"`
}

type CreateManagerShardGroupArguments

type CreateManagerShardGroupArguments struct {
	ShardIDs    string `json:"shard_ids"`
	ShardCount  int32  `json:"shard_count"`
	AutoSharded bool   `json:"auto_sharded"`
	Identifier  string `json:"identifier"`
}

type DashboardGetResponse

type DashboardGetResponse struct {
	Configuration interface{} `json:"configuration"` // Avoids circular references
}

type EmojisResponse

type EmojisResponse struct {
	BaseResponse
	GuildEmojis map[int64]*discord.Emoji
}

type FetchConsumerConfigurationRequest

type FetchConsumerConfigurationRequest struct {
	Identifier string
}

type FetchConsumerConfigurationResponse

type FetchConsumerConfigurationResponse struct {
	File []byte
}

type FetchGuildChannelsRequest

type FetchGuildChannelsRequest struct {
	GuildID    int64
	ChannelIDs []int64
	Query      string
}

type FetchGuildEmojisRequest

type FetchGuildEmojisRequest struct {
	GuildID  int64
	EmojiIDs []int64
	Query    string
}

type FetchGuildMembersRequest

type FetchGuildMembersRequest struct {
	GuildID int64
	UserIDs []int64
	Query   string
}

type FetchGuildRequest

type FetchGuildRequest struct {
	GuildIDs []int64
	Query    string
}

type FetchGuildRolesRequest

type FetchGuildRolesRequest struct {
	GuildID int64
	RoleIDs []int64
	Query   string
}

type FetchMutualGuildsRequest

type FetchMutualGuildsRequest struct {
	UserID int64
	Expand bool
}

type GuildMembersResponse

type GuildMembersResponse struct {
	BaseResponse
	GuildMembers map[int64]*discord.GuildMember
}

type GuildResponse

type GuildResponse struct {
	BaseResponse
	Guild *discord.Guild
}

type GuildRolesResponse

type GuildRolesResponse struct {
	BaseResponse
	GuildRoles map[int64]*discord.Role
}

type GuildsResponse

type GuildsResponse struct {
	BaseResponse
	Guilds   map[int64]*discord.Guild
	GuildIDs []int64
}

type IdentifyPayload

type IdentifyPayload struct {
	ShardID        int32  `json:"shard_id"`
	ShardCount     int32  `json:"shard_count"`
	Token          string `json:"token"`
	TokenHash      string `json:"token_hash"`
	MaxConcurrency int32  `json:"max_concurrency"`
}

IdentifyPayload represents the payload for external identifying.

type IdentifyResponse

type IdentifyResponse struct {
	Success bool `json:"success"`

	// If Success is false and this is passed,
	// a value of 5000 represents waiting 5 seconds.
	Wait    int32  `json:"wait"`
	Message string `json:"message"`
}

IdentifyResponse represents the response to external identifying.

type ManagerConsumerConfiguration

type ManagerConsumerConfiguration struct {
	Token string            `json:"token"`
	ID    discord.Snowflake `json:"id"`
	User  discord.User      `json:"user"`
}

type RequestGuildChunkRequest

type RequestGuildChunkRequest struct {
	GuildID int64
}

type SandwichConsumerConfiguration

type SandwichConsumerConfiguration struct {
	Version     string                                  `json:"v"`
	Identifiers map[string]ManagerConsumerConfiguration `json:"identifiers"`
}

type SandwichMetadata

type SandwichMetadata struct {
	Version       string            `json:"v"`
	Identifier    string            `json:"i"`
	Application   string            `json:"a"`
	ApplicationID discord.Snowflake `json:"id"`
	// ShardGroup ID, Shard ID, Shard Count
	Shard [3]int32 `json:"s"`
}

SandwichMetadata represents the identification information that consumers will use.

type SandwichPayload

type SandwichPayload struct {
	Op       discord.GatewayOp   `json:"op"`
	Data     jsoniter.RawMessage `json:"d"`
	Sequence int32               `json:"s"`
	Type     string              `json:"t"`

	Extra    map[string]jsoniter.RawMessage `json:"__extra"`
	Metadata SandwichMetadata               `json:"__sandwich"`
	Trace    SandwichTrace                  `json:"__sandwich_trace"`
}

SandwichPayload represents the data that is sent to consumers.

type SandwichTrace

type SandwichTrace map[string]discord.Int64

type SendWebsocketMessageRequest

type SendWebsocketMessageRequest struct {
	Manager    string
	ShardGroup int
	Shard      int

	GatewayOPCode int64
	Data          []byte
}

type ShardGroupStatus

type ShardGroupStatus uint8
const (
	ShardGroupStatusIdle ShardGroupStatus = iota
	ShardGroupStatusConnecting
	ShardGroupStatusConnected

	// Set on all non-closed ShardGroups when Manager scales.
	ShardGroupStatusMarkedForClosure

	ShardGroupStatusClosing
	ShardGroupStatusClosed
	ShardGroupStatusErroring
)

type ShardGroupStatusUpdate

type ShardGroupStatusUpdate struct {
	Manager    string           `json:"manager"`
	ShardGroup int32            `json:"shard_group"`
	Status     ShardGroupStatus `json:"status"`
}

type ShardStatus

type ShardStatus uint8
const (
	ShardStatusIdle ShardStatus = iota
	ShardStatusConnecting
	ShardStatusConnected

	// Set when a Shard has received READY event and handled.
	ShardStatusReady
	ShardStatusReconnecting

	ShardStatusClosing
	ShardStatusClosed
	ShardStatusErroring
)

type ShardStatusUpdate

type ShardStatusUpdate struct {
	Manager    string      `json:"manager"`
	ShardGroup int32       `json:"shard_group"`
	Shard      int32       `json:"shard_id"`
	Status     ShardStatus `json:"status"`
}

type StateChannel

type StateChannel struct {
	ID                         discord.Snowflake          `json:"id"`
	Type                       discord.ChannelType        `json:"type"`
	GuildID                    *discord.Snowflake         `json:"guild_id,omitempty"`
	Position                   int32                      `json:"position,omitempty"`
	PermissionOverwrites       []discord.ChannelOverwrite `json:"permission_overwrites,omitempty"`
	Name                       string                     `json:"name,omitempty"`
	Topic                      string                     `json:"topic,omitempty"`
	NSFW                       bool                       `json:"nsfw"`
	LastMessageID              string                     `json:"last_message_id,omitempty"`
	Bitrate                    int32                      `json:"bitrate,omitempty"`
	UserLimit                  int32                      `json:"user_limit,omitempty"`
	RateLimitPerUser           int32                      `json:"rate_limit_per_user,omitempty"`
	Recipients                 []discord.Snowflake        `json:"recipients,omitempty"`
	Icon                       string                     `json:"icon,omitempty"`
	OwnerID                    *discord.Snowflake         `json:"owner_id,omitempty"`
	ApplicationID              *discord.Snowflake         `json:"application_id,omitempty"`
	ParentID                   *discord.Snowflake         `json:"parent_id,omitempty"`
	LastPinTimestamp           *time.Time                 `json:"last_pin_timestamp,omitempty"`
	RTCRegion                  string                     `json:"rtc_region,omitempty"`
	VideoQualityMode           *discord.VideoQualityMode  `json:"video_quality_mode,omitempty"`
	MessageCount               int32                      `json:"message_count,omitempty"`
	MemberCount                int32                      `json:"member_count,omitempty"`
	ThreadMetadata             *discord.ThreadMetadata    `json:"thread_metadata,omitempty"`
	ThreadMember               *discord.ThreadMember      `json:"member,omitempty"`
	DefaultAutoArchiveDuration int32                      `json:"default_auto_archive_duration,omitempty"`
	Permissions                *discord.Int64             `json:"permissions,omitempty"`
}

type StateDMChannel

type StateDMChannel struct {
	*discord.Channel

	ExpiresAt discord.Int64 `json:"expires_at"`
}

type StateEmoji

type StateEmoji struct {
	ID            discord.Snowflake   `json:"id"`
	GuildID       discord.Snowflake   `json:"guild_id"`
	Name          string              `json:"name"`
	Roles         []discord.Snowflake `json:"roles,omitempty"`
	UserID        discord.Snowflake   `json:"user"`
	RequireColons bool                `json:"require_colons"`
	Managed       bool                `json:"managed"`
	Animated      bool                `json:"animated"`
	Available     bool                `json:"available"`
}

type StateGuild

type StateGuild struct {
	ID              discord.Snowflake `json:"id"`
	Name            string            `json:"name"`
	Icon            string            `json:"icon"`
	IconHash        string            `json:"icon_hash"`
	Splash          string            `json:"splash"`
	DiscoverySplash string            `json:"discovery_splash"`

	Owner       bool               `json:"owner"`
	OwnerID     *discord.Snowflake `json:"owner_id,omitempty"`
	Permissions *discord.Int64     `json:"permissions,omitempty"`
	Region      string             `json:"region"`

	AFKChannelID *discord.Snowflake `json:"afk_channel_id,omitempty"`
	AFKTimeout   int32              `json:"afk_timeout"`

	WidgetEnabled   bool               `json:"widget_enabled"`
	WidgetChannelID *discord.Snowflake `json:"widget_channel_id,omitempty"`

	VerificationLevel           discord.VerificationLevel          `json:"verification_level"`
	DefaultMessageNotifications discord.MessageNotificationLevel   `json:"default_message_notifications"`
	ExplicitContentFilter       discord.ExplicitContentFilterLevel `json:"explicit_content_filter"`

	MFALevel           discord.MFALevel            `json:"mfa_level"`
	ApplicationID      *discord.Snowflake          `json:"application_id,omitempty"`
	SystemChannelID    *discord.Snowflake          `json:"system_channel_id,omitempty"`
	SystemChannelFlags *discord.SystemChannelFlags `json:"system_channel_flags,omitempty"`
	RulesChannelID     *discord.Snowflake          `json:"rules_channel_id,omitempty"`

	JoinedAt    time.Time `json:"joined_at"`
	Large       bool      `json:"large"`
	Unavailable bool      `json:"unavailable"`
	MemberCount int32     `json:"member_count"`

	MaxPresences  int32  `json:"max_presences"`
	MaxMembers    int32  `json:"max_members"`
	VanityURLCode string `json:"vanity_url_code"`
	Description   string `json:"description"`
	Banner        string `json:"banner"`

	PremiumTier               *discord.PremiumTier        `json:"premium_tier,omitempty"`
	PremiumSubscriptionCount  int32                       `json:"premium_subscription_count"`
	PreferredLocale           string                      `json:"preferred_locale"`
	PublicUpdatesChannelID    *discord.Snowflake          `json:"public_updates_channel_id,omitempty"`
	MaxVideoChannelUsers      int32                       `json:"max_video_channel_users"`
	ApproximateMemberCount    int32                       `json:"approximate_member_count"`
	ApproximatePresenceCount  int32                       `json:"approximate_presence_count"`
	NSFWLevel                 *discord.GuildNSFWLevelType `json:"nsfw_level"`
	PremiumProgressBarEnabled bool                        `json:"premium_progress_bar_enabled"`

	RoleIDs    []discord.Snowflake `json:"role_ids"`
	EmojiIDs   []discord.Snowflake `json:"emoji_ids"`
	ChannelIDs []discord.Snowflake `json:"channel_ids"`

	Features             []string                 `json:"features"`
	StageInstances       []discord.StageInstance  `json:"stage_instances"`
	Stickers             []discord.Sticker        `json:"stickers"`
	GuildScheduledEvents []discord.ScheduledEvent `json:"guild_scheduled_events"`
}

type StateGuildChannels

type StateGuildChannels struct {
	ChannelsMu sync.RWMutex `json:"-"`

	Channels map[discord.Snowflake]*StateChannel `json:"channels"`
}

type StateGuildEmojis

type StateGuildEmojis struct {
	EmojisMu sync.RWMutex `json:"-"`

	Emojis map[discord.Snowflake]*StateEmoji `json:"emoji"`
}

type StateGuildMember

type StateGuildMember struct {
	UserID                     discord.Snowflake   `json:"user_id"`
	Nick                       string              `json:"nick"`
	Avatar                     string              `json:"avatar,omitempty"`
	Roles                      []discord.Snowflake `json:"roles"`
	JoinedAt                   time.Time           `json:"joined_at"`
	PremiumSince               string              `json:"premium_since"`
	Deaf                       bool                `json:"deaf"`
	Mute                       bool                `json:"mute"`
	Pending                    bool                `json:"pending"`
	Permissions                *discord.Int64      `json:"permissions"`
	CommunicationDisabledUntil string              `json:"communication_disabled_until,omitempty"`
}

type StateGuildMembers

type StateGuildMembers struct {
	MembersMu sync.RWMutex `json:"-"`

	Members map[discord.Snowflake]*StateGuildMember `json:"members"`
}

type StateGuildRoles

type StateGuildRoles struct {
	RolesMu sync.RWMutex `json:"-"`

	Roles map[discord.Snowflake]*StateRole `json:"roles"`
}

type StateGuildVoiceStates

type StateGuildVoiceStates struct {
	VoiceStatesMu sync.RWMutex `json:"-"`

	VoiceStates map[discord.Snowflake]*StateVoiceState `json:"voice_states"`
}

type StateMutualGuilds

type StateMutualGuilds struct {
	GuildsMu sync.RWMutex `json:"-"`

	Guilds map[discord.Snowflake]bool `json:"guilds"`
}

type StateResult

type StateResult struct {
	Data  jsoniter.RawMessage
	Extra map[string]jsoniter.RawMessage
}

StateResult represents the data a state handler would return which would be converted to a sandwich payload.

type StateRole

type StateRole struct {
	ID           discord.Snowflake `json:"id"`
	Name         string            `json:"name"`
	Color        int32             `json:"color"`
	Hoist        bool              `json:"hoist"`
	Icon         string            `json:"icon"`
	UnicodeEmoji string            `json:"unicode_emoji"`
	Position     int32             `json:"position"`
	Permissions  discord.Int64     `json:"permissions"`
	Managed      bool              `json:"managed"`
	Mentionable  bool              `json:"mentionable"`
	Tags         *discord.RoleTag  `json:"tags"`
}

type StateUser

type StateUser struct {
	ID            discord.Snowflake       `json:"id"`
	Username      string                  `json:"username"`
	Discriminator string                  `json:"discriminator"`
	GlobalName    string                  `json:"global_name"`
	Avatar        string                  `json:"avatar"`
	Bot           bool                    `json:"bot"`
	System        bool                    `json:"system,omitempty"`
	MFAEnabled    bool                    `json:"mfa_enabled,omitempty"`
	Banner        string                  `json:"banner,omitempty"`
	AccentColour  int32                   `json:"accent_color"`
	Locale        string                  `json:"locale,omitempty"`
	Verified      bool                    `json:"verified,omitempty"`
	Email         string                  `json:"email,omitempty"`
	Flags         discord.UserFlags       `json:"flags,omitempty"`
	PremiumType   discord.UserPremiumType `json:"premium_type,omitempty"`
	PublicFlags   discord.UserFlags       `json:"public_flags,omitempty"`
	DMChannelID   *discord.Snowflake      `json:"dm_channel_id,omitempty"`
}

type StateVoiceState

type StateVoiceState struct {
	ChannelID               discord.Snowflake `json:"channel_id"`
	SessionID               string            `json:"session_id"`
	Deaf                    bool              `json:"deaf"`
	Mute                    bool              `json:"mute"`
	SelfDeaf                bool              `json:"self_deaf"`
	SelfMute                bool              `json:"self_mute"`
	SelfStream              bool              `json:"self_stream"`
	SelfVideo               bool              `json:"self_video"`
	Suppress                bool              `json:"suppress"`
	RequestToSpeakTimestamp time.Time         `json:"request_to_speak_timestamp"`
}

type StatusEndpointManager

type StatusEndpointManager struct {
	DisplayName string                      `json:"display_name"`
	ShardGroups []*StatusEndpointShardGroup `json:"shard_groups"`
}

type StatusEndpointResponse

type StatusEndpointResponse struct {
	Uptime   int                      `json:"uptime"`
	Managers []*StatusEndpointManager `json:"managers"`
}

type StatusEndpointShardGroup

type StatusEndpointShardGroup struct {
	ShardGroupID int32 `json:"id"`

	// ShardID, Status, Latency (in milliseconds), Guilds, Uptime (in seconds), Total Uptime (in seconds)
	Shards [][6]int `json:"shards"`

	Status ShardGroupStatus `json:"status"`

	Uptime int `json:"uptime"`
}

type UserResponse

type UserResponse struct {
	User            discord.User `json:"user"`
	IsLoggedIn      bool         `json:"logged_in"`
	IsAuthenticated bool         `json:"authenticated"`
}

type WhereIsGuildLocation

type WhereIsGuildLocation struct {
	Manager     string
	ShardGroup  int
	ShardID     int
	GuildMember *discord.GuildMember
}

type WhereIsGuildRequest

type WhereIsGuildRequest struct {
	GuildID int64
}

type WhereIsGuildResponse

type WhereIsGuildResponse struct {
	BaseResponse
	Locations []WhereIsGuildLocation
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL