Documentation
¶
Index ¶
- Constants
- type CloseEventCode
- type ConnectionProperties
- type GuildRequestMembers
- type Heartbeat
- type Hello
- type Identify
- type Packet
- type PresenceUpdate
- type Resume
- type SpeakingFlag
- type VoiceHeartbeat
- type VoiceHello
- type VoiceIdentify
- type VoiceReady
- type VoiceResume
- type VoiceSelectProtocol
- type VoiceSessionDescription
- type VoiceSpeaking
- type VoiceStateUpdate
Constants ¶
View Source
const ( OpDispatch = 0 OpHeartbeat = 1 OpIdentify = 2 OpPresenceUpdate = 3 OpVoiceStateUpdate = 4 OpResume = 6 OpReconnect = 7 OpRequestGuildMembers = 8 OpInvalidSession = 9 OpHello = 10 OpHeartbeatAck = 11 OpVoiceIdentify = 0 OpVoiceSelectProtocol = 1 OpVoiceReady = 2 OpVoiceHeartbeat = 3 OpVoiceSessionDescription = 4 OpVoiceSpeaking = 5 OpVoiceHeartbeatAck = 6 OpVoiceResume = 7 OpVoiceHello = 8 OpVoiceResumed = 9 OpVoiceClientDisconnect = 13 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CloseEventCode ¶
type CloseEventCode int
const ( CloseEventCodeUnknownError CloseEventCode = iota + 4000 CloseEventCodeUnknownOpcode CloseEventCodeDecodeError CloseEventCodeNotAuthenticated CloseEventCodeAuthenticationFailed CloseEventCodeAlreadyAuthenticated CloseEventCodeInvalidSeq CloseEventCodeRateLimited CloseEventCodeSessionTimedOut CloseEventCodeInvalidShard CloseEventCodeShardingRequired CloseEventCodeInvalidAPIVersion CloseEventCodeInvalidIntents CloseEventCodeDisallowedIntents )
func (CloseEventCode) ShouldReconnect ¶
func (c CloseEventCode) ShouldReconnect() bool
type ConnectionProperties ¶
type GuildRequestMembers ¶
type GuildRequestMembers struct {
Packet
Data struct {
GuildId string `json:"guild_id"` // ID of the guild to get members for
Query string `json:"query,omitempty"` // string that username starts with, or an empty string to return all members
Limit int `json:"limit"` // max number of members to send matching the query; a limit of 0 can be used with an empty string query to return all members
Presences bool `json:"presences,omitempty"` // used to specify if we want the presences of the matched members
UserIds []string `json:"user_ids,omitempty"` // used to specify which users you wish to fetch
Nonce string `json:"nonce,omitempty"` // the nonce to identify the Guild Members Chunk response
} `json:"d"`
}
type Heartbeat ¶
func NewHeartbeat ¶
type Hello ¶
type Identify ¶
type Identify struct {
Packet
Data struct {
Token string `json:"token"`
Properties *ConnectionProperties `json:"properties"`
Compress bool `json:"compress,omitempty"`
LargeThreshold int `json:"large_threshold,omitempty"`
Shard []int `json:"shard,omitempty"`
Presence *PresenceUpdate `json:"presence,omitempty"`
Intents int `json:"intents,omitempty"`
} `json:"d,omitempty"`
}
func NewIdentify ¶
type Packet ¶
type Packet struct {
Opcode int `json:"op"`
Sequence int64 `json:"s,omitempty"`
Event string `json:"t,omitempty"`
Data json.RawMessage `json:"d"`
}
type PresenceUpdate ¶
type PresenceUpdate struct {
Packet
Data struct {
Since int `json:"since"`
Activities [1]*discord.Activity `json:"activities"`
Status discord.StatusType `json:"status"`
AFK bool `json:"afk"`
} `json:"d"`
}
func NewPresenceUpdate ¶
func NewPresenceUpdate(activity *discord.Activity, status discord.StatusType) *PresenceUpdate
type Resume ¶
type SpeakingFlag ¶
type SpeakingFlag uint64
const ( NotSpeaking SpeakingFlag = 0 Microphone SpeakingFlag = 1 << iota Priority )
type VoiceHeartbeat ¶
func NewVoiceHeartbeat ¶
func NewVoiceHeartbeat(data int64) *VoiceHeartbeat
type VoiceHello ¶
type VoiceIdentify ¶
type VoiceIdentify struct {
Packet
Data struct {
ServerId string `json:"server_id"`
UserID string `json:"user_id"`
SessionId string `json:"session_id"`
Token string `json:"token"`
} `json:"d,omitempty"`
}
func NewVoiceIdentify ¶
func NewVoiceIdentify(serverId, userId, sessionId, token string) *VoiceIdentify
type VoiceReady ¶
type VoiceResume ¶
type VoiceResume struct {
Packet
Data struct {
ServerId string `json:"server_id"`
SessionId string `json:"session_id"`
Token string `json:"token"`
} `json:"d,omitempty"`
}
func NewVoiceResume ¶
func NewVoiceResume(serverId, sessionId, token string) *VoiceResume
type VoiceSelectProtocol ¶
type VoiceSelectProtocol struct {
Packet
Data struct {
Protocol string `json:"protocol"`
Data struct {
Address string `json:"address"`
Port uint16 `json:"port"`
Mode string `json:"mode"` // always "xsalsa20_poly1305"
} `json:"data"`
} `json:"d,omitempty"`
}
func NewVoiceSelectProtocol ¶
func NewVoiceSelectProtocol(address string, port uint16) *VoiceSelectProtocol
type VoiceSessionDescription ¶
type VoiceSpeaking ¶
type VoiceSpeaking struct {
Packet
Data struct {
Speaking SpeakingFlag `json:"speaking"`
Delay int `json:"delay"`
SSRC uint32 `json:"ssrc"`
UserId string `json:"user_id,omitempty"`
} `json:"d"`
}
func NewVoiceSpeaking ¶
func NewVoiceSpeaking(speaking bool, ssrc uint32) *VoiceSpeaking
type VoiceStateUpdate ¶
type VoiceStateUpdate struct {
Packet
Data struct {
GuildId *string `json:"guild_id"`
ChannelId *string `json:"channel_id"`
SelfMute bool `json:"self_mute"`
SelfDeaf bool `json:"self_deaf"`
} `json:"d,omitempty"`
}
func NewVoiceStateUpdate ¶
func NewVoiceStateUpdate(guildId, channelId string, selfMuted, selfDeaf bool) *VoiceStateUpdate
Source Files
¶
Click to show internal directories.
Click to hide internal directories.