Versions in this module Expand all Collapse all v0 v0.101.0 Sep 8, 2023 v0.5.1 Aug 27, 2023 Changes in this version + type ActivityOpt func(activity discord.Activity) + func WithActivityState(state string) ActivityOpt type EventMessageReactionAdd + Burst bool + BurstColors []string type EventMessageReactionRemove + Burst bool + BurstColors []string type PresenceOpt + func WithCustomActivity(status string, opts ...ActivityOpt) PresenceOpt v0.5.0 Aug 5, 2023 Changes in this version type EventMessageReactionAdd + MessageAuthorID *snowflake.ID v0.4.1 Jul 7, 2023 v0.4.0 Jun 28, 2023 v0.3.0 Jun 11, 2023 v0.2.2 Jun 10, 2023 v0.2.1 Jun 9, 2023 v0.2.0 Jun 8, 2023 Changes in this version + const Version + var CloseEventCodeAlreadyAuthenticated = CloseEventCode + var CloseEventCodeAuthenticationFailed = CloseEventCode + var CloseEventCodeDecodeError = CloseEventCode + var CloseEventCodeDisallowedIntent = CloseEventCode + var CloseEventCodeInvalidAPIVersion = CloseEventCode + var CloseEventCodeInvalidIntent = CloseEventCode + var CloseEventCodeInvalidSeq = CloseEventCode + var CloseEventCodeInvalidShard = CloseEventCode + var CloseEventCodeNotAuthenticated = CloseEventCode + var CloseEventCodeRateLimited = CloseEventCode + var CloseEventCodeSessionTimed = CloseEventCode + var CloseEventCodeShardingRequired = CloseEventCode + var CloseEventCodeUnknown = CloseEventCode + var CloseEventCodeUnknownError = CloseEventCode + var CloseEventCodeUnknownOpcode = CloseEventCode + var CloseEventCodes = map[int]CloseEventCode + type AddedThreadMember struct + Member discord.Member + Presence *discord.Presence + type CloseEventCode struct + Code int + Description string + Explanation string + Reconnect bool + func CloseEventCodeByCode(code int) CloseEventCode + type CloseHandlerFunc func(gateway Gateway, err error) + type Config struct + AutoReconnect bool + Browser string + Compress bool + Device string + Dialer *websocket.Dialer + EnableRawEvents bool + EnableResumeURL bool + Intents Intents + LargeThreshold int + LastSequenceReceived *int + Logger log.Logger + OS string + Presence *MessageDataPresenceUpdate + RateLimiter RateLimiter + RateRateLimiterConfigOpts []RateLimiterConfigOpt + ResumeURL *string + SessionID *string + ShardCount int + ShardID int + URL string + func DefaultConfig() *Config + func (c *Config) Apply(opts []ConfigOpt) + type ConfigOpt func(config *Config) + func WithAutoReconnect(autoReconnect bool) ConfigOpt + func WithBrowser(browser string) ConfigOpt + func WithCompress(compress bool) ConfigOpt + func WithDevice(device string) ConfigOpt + func WithDialer(dialer *websocket.Dialer) ConfigOpt + func WithEnableRawEvents(enableRawEventEvents bool) ConfigOpt + func WithEnableResumeURL(enableResumeURL bool) ConfigOpt + func WithIntents(intents ...Intents) ConfigOpt + func WithLargeThreshold(largeThreshold int) ConfigOpt + func WithLogger(logger log.Logger) ConfigOpt + func WithOS(os string) ConfigOpt + func WithPresenceOpts(opts ...PresenceOpt) ConfigOpt + func WithRateLimiter(rateLimiter RateLimiter) ConfigOpt + func WithRateRateLimiterConfigOpts(opts ...RateLimiterConfigOpt) ConfigOpt + func WithSequence(sequence int) ConfigOpt + func WithSessionID(sessionID string) ConfigOpt + func WithShardCount(shardCount int) ConfigOpt + func WithShardID(shardID int) ConfigOpt + func WithURL(url string) ConfigOpt + type CreateFunc func(token string, eventHandlerFunc EventHandlerFunc, ...) Gateway + type EventApplicationCommandPermissionsUpdate struct + type EventAutoModerationActionExecution struct + Action discord.AutoModerationAction + AlertSystemMessageID snowflake.ID + ChannelID *snowflake.ID + Content string + GuildID snowflake.ID + MatchedContent *string + MatchedKeywords *string + MessageID *snowflake.ID + RuleID snowflake.ID + RuleTriggerType discord.AutoModerationTriggerType + UserID snowflake.ID + type EventAutoModerationRuleCreate struct + type EventAutoModerationRuleDelete struct + type EventAutoModerationRuleUpdate struct + type EventChannelCreate struct + func (e *EventChannelCreate) UnmarshalJSON(data []byte) error + type EventChannelDelete struct + func (e *EventChannelDelete) UnmarshalJSON(data []byte) error + type EventChannelPinsUpdate struct + ChannelID snowflake.ID + GuildID *snowflake.ID + LastPinTimestamp *time.Time + type EventChannelUpdate struct + func (e *EventChannelUpdate) UnmarshalJSON(data []byte) error + type EventData interface + func UnmarshalEventData(data []byte, eventType EventType) (EventData, error) + type EventGuildAuditLogEntryCreate struct + GuildID snowflake.ID + type EventGuildBanAdd struct + GuildID snowflake.ID + User discord.User + type EventGuildBanRemove struct + GuildID snowflake.ID + User discord.User + type EventGuildCreate struct + type EventGuildDelete struct + type EventGuildEmojisUpdate struct + Emojis []discord.Emoji + GuildID snowflake.ID + func (e *EventGuildEmojisUpdate) UnmarshalJSON(data []byte) error + type EventGuildIntegrationsUpdate struct + GuildID snowflake.ID + type EventGuildMemberAdd struct + type EventGuildMemberRemove struct + GuildID snowflake.ID + User discord.User + type EventGuildMemberUpdate struct + type EventGuildMembersChunk struct + ChunkCount int + ChunkIndex int + GuildID snowflake.ID + Members []discord.Member + Nonce string + NotFound []snowflake.ID + Presences []discord.Presence + type EventGuildRoleCreate struct + GuildID snowflake.ID + Role discord.Role + func (e *EventGuildRoleCreate) MarshalJSON() ([]byte, error) + func (e *EventGuildRoleCreate) UnmarshalJSON(data []byte) error + type EventGuildRoleDelete struct + GuildID snowflake.ID + RoleID snowflake.ID + type EventGuildRoleUpdate struct + GuildID snowflake.ID + Role discord.Role + func (e *EventGuildRoleUpdate) MarshalJSON() ([]byte, error) + func (e *EventGuildRoleUpdate) UnmarshalJSON(data []byte) error + type EventGuildScheduledEventCreate struct + type EventGuildScheduledEventDelete struct + type EventGuildScheduledEventUpdate struct + type EventGuildScheduledEventUserAdd struct + GuildID snowflake.ID + GuildScheduledEventID snowflake.ID + UserID snowflake.ID + type EventGuildScheduledEventUserRemove struct + GuildID snowflake.ID + GuildScheduledEventID snowflake.ID + UserID snowflake.ID + type EventGuildStickersUpdate struct + GuildID snowflake.ID + Stickers []discord.Sticker + type EventGuildUpdate struct + type EventHandlerFunc func(gatewayEventType EventType, sequenceNumber int, shardID int, event EventData) + type EventHeartbeatAck struct + LastHeartbeat time.Time + NewHeartbeat time.Time + type EventIntegrationCreate struct + GuildID snowflake.ID + func (e *EventIntegrationCreate) UnmarshalJSON(data []byte) error + type EventIntegrationDelete struct + ApplicationID *snowflake.ID + GuildID snowflake.ID + ID snowflake.ID + type EventIntegrationUpdate struct + GuildID snowflake.ID + func (e *EventIntegrationUpdate) UnmarshalJSON(data []byte) error + type EventInteractionCreate struct + func (e *EventInteractionCreate) UnmarshalJSON(data []byte) error + func (e EventInteractionCreate) MarshalJSON() ([]byte, error) + type EventInviteCreate struct + type EventInviteDelete struct + ChannelID snowflake.ID + Code string + GuildID *snowflake.ID + type EventMessageCreate struct + type EventMessageDelete struct + ChannelID snowflake.ID + GuildID *snowflake.ID + ID snowflake.ID + type EventMessageDeleteBulk struct + ChannelID snowflake.ID + GuildID *snowflake.ID + IDs []snowflake.ID + type EventMessageReactionAdd struct + ChannelID snowflake.ID + Emoji discord.PartialEmoji + GuildID *snowflake.ID + Member *discord.Member + MessageID snowflake.ID + UserID snowflake.ID + func (e *EventMessageReactionAdd) UnmarshalJSON(data []byte) error + type EventMessageReactionRemove struct + ChannelID snowflake.ID + Emoji discord.PartialEmoji + GuildID *snowflake.ID + MessageID snowflake.ID + UserID snowflake.ID + type EventMessageReactionRemoveAll struct + ChannelID snowflake.ID + GuildID *snowflake.ID + MessageID snowflake.ID + type EventMessageReactionRemoveEmoji struct + ChannelID snowflake.ID + Emoji discord.PartialEmoji + GuildID *snowflake.ID + MessageID snowflake.ID + type EventMessageUpdate struct + type EventPresenceUpdate struct + type EventRaw struct + EventType EventType + Payload io.Reader + type EventReady struct + Application discord.PartialApplication + Guilds []discord.UnavailableGuild + ResumeGatewayURL string + SessionID string + Shard [2]int + User discord.OAuth2User + Version int + type EventStageInstanceCreate struct + type EventStageInstanceDelete struct + type EventStageInstanceUpdate struct + type EventThreadCreate struct + ThreadMember discord.ThreadMember + type EventThreadDelete struct + GuildID snowflake.ID + ID snowflake.ID + ParentID snowflake.ID + Type discord.ChannelType + type EventThreadListSync struct + ChannelIDs []snowflake.ID + GuildID snowflake.ID + Members []discord.ThreadMember + Threads []discord.GuildThread + type EventThreadMemberUpdate struct + type EventThreadMembersUpdate struct + AddedMembers []AddedThreadMember + GuildID snowflake.ID + ID snowflake.ID + MemberCount int + RemovedMemberIDs []snowflake.ID + type EventThreadUpdate struct + type EventType string + const EventTypeApplicationCommandPermissionsUpdate + const EventTypeAutoModerationActionExecution + const EventTypeAutoModerationRuleCreate + const EventTypeAutoModerationRuleDelete + const EventTypeAutoModerationRuleUpdate + const EventTypeChannelCreate + const EventTypeChannelDelete + const EventTypeChannelPinsUpdate + const EventTypeChannelUpdate + const EventTypeGuildAuditLogEntryCreate + const EventTypeGuildBanAdd + const EventTypeGuildBanRemove + const EventTypeGuildCreate + const EventTypeGuildDelete + const EventTypeGuildEmojisUpdate + const EventTypeGuildIntegrationsUpdate + const EventTypeGuildMemberAdd + const EventTypeGuildMemberRemove + const EventTypeGuildMemberUpdate + const EventTypeGuildMembersChunk + const EventTypeGuildRoleCreate + const EventTypeGuildRoleDelete + const EventTypeGuildRoleUpdate + const EventTypeGuildScheduledEventCreate + const EventTypeGuildScheduledEventDelete + const EventTypeGuildScheduledEventUpdate + const EventTypeGuildScheduledEventUserAdd + const EventTypeGuildScheduledEventUserRemove + const EventTypeGuildStickersUpdate + const EventTypeGuildUpdate + const EventTypeHeartbeatAck + const EventTypeIntegrationCreate + const EventTypeIntegrationDelete + const EventTypeIntegrationUpdate + const EventTypeInteractionCreate + const EventTypeInviteCreate + const EventTypeInviteDelete + const EventTypeMessageCreate + const EventTypeMessageDelete + const EventTypeMessageDeleteBulk + const EventTypeMessageReactionAdd + const EventTypeMessageReactionRemove + const EventTypeMessageReactionRemoveAll + const EventTypeMessageReactionRemoveEmoji + const EventTypeMessageUpdate + const EventTypePresenceUpdate + const EventTypeRaw + const EventTypeReady + const EventTypeResumed + const EventTypeStageInstanceCreate + const EventTypeStageInstanceDelete + const EventTypeStageInstanceUpdate + const EventTypeThreadCreate + const EventTypeThreadDelete + const EventTypeThreadListSync + const EventTypeThreadMemberUpdate + const EventTypeThreadMembersUpdate + const EventTypeThreadUpdate + const EventTypeTypingStart + const EventTypeUserUpdate + const EventTypeVoiceServerUpdate + const EventTypeVoiceStateUpdate + const EventTypeWebhooksUpdate + type EventTypingStart struct + ChannelID snowflake.ID + GuildID *snowflake.ID + Member *discord.Member + Timestamp time.Time + User discord.User + UserID snowflake.ID + func (e *EventTypingStart) UnmarshalJSON(data []byte) error + type EventUnknown json.RawMessage + func (e *EventUnknown) UnmarshalJSON(data []byte) error + func (e EventUnknown) MarshalJSON() ([]byte, error) + type EventUserUpdate struct + type EventVoiceServerUpdate struct + Endpoint *string + GuildID snowflake.ID + Token string + type EventVoiceStateUpdate struct + Member discord.Member + type EventWebhooksUpdate struct + ChannelID snowflake.ID + GuildID snowflake.ID + type Gateway interface + Close func(ctx context.Context) + CloseWithCode func(ctx context.Context, code int, message string) + Intents func() Intents + LastSequenceReceived func() *int + Latency func() time.Duration + Open func(ctx context.Context) error + Presence func() *MessageDataPresenceUpdate + Send func(ctx context.Context, op Opcode, data MessageData) error + SessionID func() *string + ShardCount func() int + ShardID func() int + Status func() Status + func New(token string, eventHandlerFunc EventHandlerFunc, ...) Gateway + type IdentifyCommandDataProperties struct + Browser string + Device string + OS string + type Intents int64 + const IntentAutoModerationConfiguration + const IntentAutoModerationExecution + const IntentDirectMessageReactions + const IntentDirectMessageTyping + const IntentDirectMessages + const IntentGuildEmojisAndStickers + const IntentGuildIntegrations + const IntentGuildInvites + const IntentGuildMembers + const IntentGuildMessageReactions + const IntentGuildMessageTyping + const IntentGuildMessages + const IntentGuildModeration + const IntentGuildPresences + const IntentGuildScheduledEvents + const IntentGuildVoiceStates + const IntentGuildWebhooks + const IntentGuilds + const IntentMessageContent + const IntentsAll + const IntentsDefault + const IntentsDirectMessage + const IntentsGuild + const IntentsNonPrivileged + const IntentsNone + const IntentsPrivileged + func (i Intents) Add(bits ...Intents) Intents + func (i Intents) Has(bits ...Intents) bool + func (i Intents) Missing(bits ...Intents) bool + func (i Intents) Remove(bits ...Intents) Intents + type Message struct + D MessageData + Op Opcode + RawD json.RawMessage + S int + T EventType + func (e *Message) UnmarshalJSON(data []byte) error + type MessageData interface + type MessageDataHeartbeat int + type MessageDataHello struct + HeartbeatInterval int + type MessageDataIdentify struct + Compress bool + Intents Intents + LargeThreshold int + Presence *MessageDataPresenceUpdate + Properties IdentifyCommandDataProperties + Shard *[2]int + Token string + type MessageDataInvalidSession bool + type MessageDataPresenceUpdate struct + AFK bool + Activities []discord.Activity + Since *int64 + Status discord.OnlineStatus + type MessageDataRequestGuildMembers struct + GuildID snowflake.ID + Limit *int + Nonce string + Presences bool + Query *string + UserIDs []snowflake.ID + type MessageDataResume struct + Seq int + SessionID string + Token string + type MessageDataUnknown json.RawMessage + type MessageDataVoiceStateUpdate struct + ChannelID *snowflake.ID + GuildID snowflake.ID + SelfDeaf bool + SelfMute bool + type Opcode int + const OpcodeDispatch + const OpcodeHeartbeat + const OpcodeHeartbeatACK + const OpcodeHello + const OpcodeIdentify + const OpcodeInvalidSession + const OpcodePresenceUpdate + const OpcodeReconnect + const OpcodeRequestGuildMembers + const OpcodeResume + const OpcodeVoiceStateUpdate + type PresenceOpt func(presenceUpdate *MessageDataPresenceUpdate) + func WithAfk(afk bool) PresenceOpt + func WithCompetingActivity(name string) PresenceOpt + func WithListeningActivity(name string) PresenceOpt + func WithOnlineStatus(status discord.OnlineStatus) PresenceOpt + func WithPlayingActivity(name string) PresenceOpt + func WithSince(since *int64) PresenceOpt + func WithStreamingActivity(name string, url string) PresenceOpt + func WithWatchingActivity(name string) PresenceOpt + type RateLimiter interface + Close func(ctx context.Context) + Reset func() + Unlock func() + Wait func(ctx context.Context) error + func NewRateLimiter(opts ...RateLimiterConfigOpt) RateLimiter + type RateLimiterConfig struct + CommandsPerMinute int + Logger log.Logger + func DefaultRateLimiterConfig() *RateLimiterConfig + func (c *RateLimiterConfig) Apply(opts []RateLimiterConfigOpt) + type RateLimiterConfigOpt func(config *RateLimiterConfig) + func WithCommandsPerMinute(commandsPerMinute int) RateLimiterConfigOpt + func WithRateLimiterLogger(logger log.Logger) RateLimiterConfigOpt + type Status int + const StatusConnecting + const StatusDisconnected + const StatusIdentifying + const StatusReady + const StatusResuming + const StatusUnconnected + const StatusWaitingForHello + const StatusWaitingForReady + func (s Status) IsConnected() bool