Documentation
¶
Index ¶
- Variables
- type ChannelPinsUpdateEvent
- type Config
- type ErrNotFound
- type Event
- type Gateway
- type GatewayIntent
- type GuildBanEvent
- type GuildCreateEvent
- type GuildMemberAddEvent
- type GuildMemberRemoveEvent
- type GuildMemberUpdateEvent
- type GuildMembersChunkEvent
- type GuildRoleDeleteEvent
- type GuildRoleEvent
- type GuildScheduledUserEvent
- type HelloOp
- type Identify
- type IdentifyProperties
- type InternalConnectionClosed
- type InternalDispatchEvent
- type InternalEventAllocator
- type InternalHeartbeatEvent
- type InternalMaxReconnectionLimitReached
- type InternalReadyEvent
- type InternalStatusChangeEvent
- type InviteCreateEvent
- type InviteDeleteEvent
- type MessageCreateEvent
- type MessageDeleteEvent
- type ReadyEvent
- type RequestGuildMembersParams
- type Status
- type ThreadCreateEvent
- type ThreadDeleteEvent
- type ThreadListSyncEvent
- type ThreadMembersUpdateEvent
- type UnavailableGuild
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrGatewayNotConnected = errors.New("gateway is disconnected from Discord") ErrFetchingMembersTimedOut = errors.New("could not wait longer for guild members chunk") )
Functions ¶
This section is empty.
Types ¶
type ChannelPinsUpdateEvent ¶
type ErrNotFound ¶
func (ErrNotFound) Error ¶
func (e ErrNotFound) Error() string
type Event ¶
type Event struct {
OpCode uint `json:"op"`
Data json.RawMessage `json:"d"`
Seq uint64 `json:"s"`
Event string `json:"t"`
// contains filtered or unexported fields
}
func (*Event) Dereference ¶
func (e *Event) Dereference()
type Gateway ¶
type Gateway interface {
Listen() (events <-chan any, cancel func())
Disconnect()
Connect(ctx context.Context) error
Config() Config
Status() Status
Log() golog.Logger
FetchMembers(ctx context.Context, params RequestGuildMembersParams) ([]discord.MemberWithUser, []discord.Presence, error)
}
func NewGateway ¶
type GatewayIntent ¶
type GatewayIntent uint
const ( GatewayIntentGuilds GatewayIntent = 1 << 0 GatewayIntentGuildMembers GatewayIntent = 1 << 1 GatewayIntentGuildModeration GatewayIntent = 1 << 2 GatewayIntentGuildEmojisAndStickers GatewayIntent = 1 << 3 GatewayIntentGuildIntegrations GatewayIntent = 1 << 4 GatewayIntentGuildWebhooks GatewayIntent = 1 << 5 GatewayIntentGuildInvites GatewayIntent = 1 << 6 GatewayIntentGuildVoiceStates GatewayIntent = 1 << 7 GatewayIntentGuildPresences GatewayIntent = 1 << 8 GatewayIntentGuildMessages GatewayIntent = 1 << 9 GatewayIntentGuildMessageReactions GatewayIntent = 1 << 10 GatewayIntentGuildMessageTyping GatewayIntent = 1 << 11 GatewayIntentGuildDirectMessages GatewayIntent = 1 << 12 GatewayIntentDirectMessageReactions GatewayIntent = 1 << 13 GatewayIntentDirectMessageTyping GatewayIntent = 1 << 14 GatewayIntentMessageContent GatewayIntent = 1 << 15 GatewayIntentGuildScheduledEvents GatewayIntent = 1 << 16 GatewayIntentAutoModerationConfiguration GatewayIntent = 1 << 20 GatewayIntentAutoModerationExecution GatewayIntent = 1 << 21 GatewayIntentGuildMessagePolls GatewayIntent = 1 << 24 GatewayIntentDirectMessagePolls GatewayIntent = 1 << 25 GatewayIntentDefault = GatewayIntentGuilds | GatewayIntentGuildMembers | GatewayIntentGuildModeration | GatewayIntentGuildEmojisAndStickers | GatewayIntentGuildIntegrations | GatewayIntentGuildWebhooks | GatewayIntentGuildInvites | GatewayIntentGuildVoiceStates | GatewayIntentGuildMessages | GatewayIntentGuildMessageReactions | GatewayIntentGuildDirectMessages | GatewayIntentDirectMessageReactions | GatewayIntentMessageContent | GatewayIntentGuildScheduledEvents | GatewayIntentAutoModerationConfiguration | GatewayIntentAutoModerationExecution | GatewayIntentGuildMessagePolls | GatewayIntentDirectMessagePolls )
type GuildBanEvent ¶
type GuildCreateEvent ¶
type GuildCreateEvent struct {
discord.Guild
JoinedAt discord.Timestamp `json:"joined_at,omitempty"`
Large bool `json:"large,omitempty"`
MemberCount uint `json:"member_count,omitempty"`
Members []discord.MemberWithUser `json:"members,omitempty"`
Channels []discord.Channel `json:"channels,omitempty"`
Threads []discord.Channel `json:"threads,omitempty"`
Presences []discord.Presence `json:"presences,omitempty"`
GuildScheduledEvents []discord.ScheduledEvent `json:"guild_scheduled_events,omitempty"`
StageInstances []discord.StageInstance `json:"stage_instances,omitempty"`
VoiceStates []discord.VoiceState `json:"voice_states,omitempty"`
}
type GuildMemberAddEvent ¶
type GuildMemberAddEvent struct {
discord.MemberWithUser
GuildID snowflake.ID `json:"guild_id,omitempty"`
}
type GuildMemberRemoveEvent ¶
type GuildMemberUpdateEvent ¶
type GuildMemberUpdateEvent struct {
discord.MemberWithUser
GuildID snowflake.ID `json:"guild_id,omitempty"`
}
type GuildMembersChunkEvent ¶
type GuildMembersChunkEvent struct {
GuildID snowflake.ID `json:"guild_id,omitempty"`
Members []discord.MemberWithUser `json:"members,omitempty"`
ChunkIndex int `json:"chunk_index,omitempty"`
ChunkCount int `json:"chunk_count,omitempty"`
NotFound []snowflake.ID `json:"not_found,omitempty"`
Presences []discord.Presence `json:"presences,omitempty"`
Nonce string `json:"nonce,omitempty"`
}
type GuildRoleDeleteEvent ¶
type GuildRoleEvent ¶
type GuildScheduledUserEvent ¶
type Identify ¶
type Identify struct {
Token string `json:"token"`
Properties IdentifyProperties `json:"properties"`
Compress bool `json:"compress,omitempty"`
LargeThreshold int `json:"large_threshold,omitempty"`
Shard []uint16 `json:"shard"`
Intents GatewayIntent `json:"intents"`
}
type IdentifyProperties ¶
type InternalConnectionClosed ¶
type InternalConnectionClosed struct{}
InternalConnectionClosed is sent when Gateway Status changes to StatusDisconnected
type InternalDispatchEvent ¶
type InternalDispatchEvent = *Event
type InternalEventAllocator ¶
type InternalEventAllocator interface {
Dereference()
// contains filtered or unexported methods
}
type InternalMaxReconnectionLimitReached ¶
type InternalMaxReconnectionLimitReached struct{}
type InternalReadyEvent ¶
type InternalReadyEvent = *ReadyEvent
type InternalStatusChangeEvent ¶
type InternalStatusChangeEvent Status
type InviteCreateEvent ¶
type InviteDeleteEvent ¶
type MessageCreateEvent ¶
type MessageDeleteEvent ¶
type ReadyEvent ¶
type ReadyEvent struct {
Version uint `json:"v"`
User discord.User `json:"user"`
Guilds []UnavailableGuild `json:"guilds"`
SessionID string `json:"session_id"`
Shard [2]uint16 `json:"shard"`
Application discord.Application `json:"application"`
ResumeGatewayURL string `json:"resume_gateway_url"`
}
type ThreadCreateEvent ¶
type ThreadDeleteEvent ¶
type ThreadListSyncEvent ¶
type ThreadMembersUpdateEvent ¶
type ThreadMembersUpdateEvent struct {
ID snowflake.ID `json:"id,omitempty"`
GuildID snowflake.ID `json:"guild_id,omitempty"`
MemberCount int `json:"member_count,omitempty"`
AddedMembers []discord.ThreadMember `json:"added_members,omitempty"`
RemovedMemberIDs []snowflake.ID `json:"removed_member_i_ds,omitempty"`
}
type UnavailableGuild ¶
type UnavailableGuild struct {
}
Click to show internal directories.
Click to hide internal directories.