event

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2018 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package description

Index

Constants

View Source
const (
	AllEventsKey = "GOD_DAMN_EVERYTHING"

	// Ready The ready event is dispatched when a client has completed the
	//       initial handshake with the gateway (for new sessions). The ready
	//       event can be the largest and most complex event the gateway will
	//       send, as it contains all the state required for a client to begin
	//       interacting with the rest of the platform.
	//       Fields:
	//       * V uint8
	//       * User *discord.user.User
	//       * PrivateChannels []*discord.channel.Private
	//       * Guilds []*discord.guild.Unavailable
	//       * SessionID string
	//       * Trace []string
	ReadyKey = "READY"
	// Resumed The resumed event is dispatched when a client has sent a resume
	//         payload to the gateway (for resuming existing sessions).
	//         Fields:
	//         * Trace []string
	ResumedKey = "RESUMED"

	// ChannelCreate Sent when a new channel is created, relevant to the current
	//               user. The inner payload is a DM channel or guild channel
	//               object.
	ChannelCreateKey = "CHANNEL_CREATE"
	// ChannelUpdate Sent when a channel is updated. The inner payload is a guild
	//               channel object.
	ChannelUpdateKey = "CHANNEL_UPDATE"
	// ChannelDelete Sent when a channel relevant to the current user is deleted.
	//               The inner payload is a DM or Guild channel object.
	ChannelDeleteKey = "CHANNEL_DELETE"
	// ChannelPinsUpdate Sent when a message is pinned or unpinned in a text
	//                   channel. This is not sent when a pinned message is
	//                   deleted.
	//                   Fields:
	//                   * ChannelID int64 or discord.Snowflake
	//                   * LastPinTimestamp time.Now().UTC().Format(time.RFC3339)
	// TODO fix.
	ChannelPinsUpdateKey = "CHANNEL_PINS_UPDATE"

	// GuildCreate This event can be sent in three different scenarios:
	//             1. When a user is initially connecting, to lazily load and
	//                backfill information for all unavailable guilds sent in the
	//                Ready event.
	//             2. When a Guild becomes available again to the client.
	//             3. When the current user joins a new Guild.
	//             The inner payload is a guild object, with all the extra fields
	//             specified.
	GuildCreateKey = "GUILD_CREATE"
	// GuildUpdate Sent when a guild is updated. The inner payload is a guild
	//             object.
	GuildUpdateKey = "GUILD_UPDATE"
	// GuildDelete Sent when a guild becomes unavailable during a guild outage,
	//             or when the user leaves or is removed from a guild. The inner
	//             payload is an unavailable guild object. If the unavailable
	//             field is not set, the user was removed from the guild.
	GuildDeleteKey = "GUILD_DELETE"
	// GuildBanAdd Sent when a user is banned from a guild. The inner payload is
	//             a user object, with an extra guild_id key.
	GuildBanAddKey = "GUILD_BAN_ADD"
	// GuildBanRemove Sent when a user is unbanned from a guild. The inner
	//                payload is a user object, with an extra guild_id key.
	GuildBanRemoveKey = "GUILD_BAN_REMOVE"
	// GuildEmojisUpdate Sent when a guild's emojis have been updated.
	//                   Fields:
	//                   * GuildID int64 or discord.Snowflake
	GuildEmojisUpdateKey = "GUILD_EMOJI_UPDATE"
	//GuildIntegrationsUpdate Sent when a guild integration is updated.
	//                        Fields:
	//                        * GuildID int64 or discord.Snowflake
	//                        * Emojis []*discord.emoji.Emoji
	GuildIntegrationsUpdateKey = "GUILD_INTEGRATIONS_UPDATE"
	// GuildMemberAdd Sent when a new user joins a guild. The inner payload is a
	//                guild member object with these extra fields:
	//                * GuildID int64 or discord.Snowflake
	GuildMemberAddKey = "GUILD_MEMBER_ADD"
	// GuildMemberRemove Sent when a user is removed from a guild
	//                   (leave/kick/ban).
	//                   Fields:
	//                   * GuildID int64 or discord.Snowflake
	//                   * User *discord.user.User
	GuildMemberRemoveKey = "GUILD_MEMBER_REMOVE"
	// GuildMemberUpdate Sent when a guild member is updated.
	//                   Fields:
	//                   * GuildID int64 or discord.Snowflake
	//                   * Roles []int64 or []discord.Snowflake
	//                   * User *discord.user.User
	//                   * Nick string
	GuildMemberUpdateKey = "GUILD_MEMBER_UPDATE"
	// GuildMemberChunk Sent in response to Gateway Request Guild Members.
	//                  Fields:
	//                  * GuildID int64 or discord.Snowflake
	//                  * Members []*discord.member.Member
	GuildMembersChunkKey = "GUILD_MEMBER_CHUNK"
	// GuildRoleCreate Sent when a guild role is created.
	//                 Fields:
	//                 * GuildID int64 or discord.Snowflake
	//                 * Role *discord.role.Role
	GuildRoleCreateKey = "GUILD_ROLE_CREATE"
	// GuildRoleUpdate Sent when a guild role is created.
	//                 Fields:
	//                 * GuildID int64 or discord.Snowflake
	//                 * Role    *discord.role.Role
	GuildRoleUpdateKey = "GUILD_ROLE_UPDATE"
	// GuildRoleDelete Sent when a guild role is created.
	//                 Fields:
	//                 * GuildID int64 or discord.Snowflake
	//                 * RoleID  int64 or discord.Snowflake
	GuildRoleDeleteKey = "GUILD_ROLE_DELETE"
	// MessageCreate Sent when a message is created. The inner payload is a
	//               message object.
	MessageCreateKey = "MESSAGE_CREATE"
	// MessageUpdate Sent when a message is updated. The inner payload is a
	//               message object.
	//               NOTE! Has _at_least_ the GuildID and ChannelID fields.
	MessageUpdateKey = "MESSAGE_UPDATE"
	// MessageDelete Sent when a message is deleted.
	//               Fields:
	//               * ID        int64 or discord.Snowflake
	//               * ChannelID int64 or discord.Snowflake
	MessageDeleteKey = "MESSAGE_DELETE"
	// MessageDeleteBulk Sent when multiple messages are deleted at once.
	//                   Fields:
	//                   * IDs       []int64 or []discord.Snowflake
	//                   * ChannelID int64 or discord.Snowflake
	MessageDeleteBulkKey = "MESSAGE_DELETE_BULK"
	// MessageReactionAdd Sent when a user adds a reaction to a message.
	//                    Fields:
	//                    * UserID     int64 or discord.Snowflake
	//                    * ChannelID  int64 or discord.Snowflake
	//                    * MessageID  int64 or discord.Snowflake
	//                    * Emoji      *discord.emoji.Emoji
	MessageReactionAddKey = "MESSAGE_REACTION_ADD"
	// MessageReactionRemove Sent when a user removes a reaction from a message.
	//                       Fields:
	//                       * UserID     int64 or discord.Snowflake
	//                       * ChannelID  int64 or discord.Snowflake
	//                       * MessageID  int64 or discord.Snowflake
	//                       * Emoji      *discord.emoji.Emoji
	MessageReactionRemoveKey = "MESSAGE_REACTION_REMOVE"
	// MessageReactionRemoveAll Sent when a user explicitly removes all reactions
	//                          from a message.
	//                          Fields:
	//                          * ChannelID  int64 or discord.Snowflake
	//                          * MessageID  int64 or discord.Snowflake
	MessageReactionRemoveAllKey = "MESSAGE_REACTION_REMOVE_ALL"
	// PresenceUpdate A user's presence is their current state on a guild.
	//                This event is sent when a user's presence is updated
	//                for a guild.
	//                Fields:
	//                User    *discord.user.User
	//                Roles   []*discord.role.Role
	//                Game    *discord.game.Game
	//                GuildID int64 or discord.Snowflake
	//                Status  *string or *discord.presence.Status
	PresenceUpdateKey = "PRESENCE_UPDATE"
	// TypingStart Sent when a user starts typing in a channel.
	//             Fields: TODO
	TypingStartKey = "TYPING_START"
	// UserUpdate Sent when properties about the user change. Inner payload is a
	//            user object.
	UserUpdateKey = "USER_UPDATE"
	// VoiceStateUpdate Sent when someone joins/leaves/moves voice channels.
	//                  Inner payload is a voice state object.
	VoiceStateUpdateKey = "VOICE_STATE_UPDATE"
	// VoiceServerUpdate Sent when a guild's voice server is updated. This is
	//                   sent when initially connecting to voice, and when the
	//                   current voice instance fails over to a new server.
	//                   Fields:
	//                   * Token     string or discord.Token
	//                   * ChannelID int64 or discord.Snowflake
	//                   * Endpoint  string or discord.Endpoint
	VoiceServerUpdateKey = "VOICE_SERVER_UPDATE"
	// WebhooksUpdate Sent when a guild channel's webhook is created, updated, or
	//                deleted.
	//                Fields:
	//                * GuildID   int64 or discord.Snowflake
	//                * ChannelID int64 or discord.Snowflake
	WebhooksUpdateKey = "WEBHOOK_UPDATE"
)

The different discord Event Keys

Variables

This section is empty.

Functions

This section is empty.

Types

type ChannelCreateBox

type ChannelCreateBox struct {
	Channel *resource.Channel `json:"channel"`
	Ctx     context.Context   `json:"-"`
}

ChannelCreateBox new channel created

type ChannelDeleteBox

type ChannelDeleteBox struct {
	Channel *resource.Channel `json:"channel"`
	Ctx     context.Context   `json:"-"`
}

ChannelDeleteBox channel was deleted

type ChannelPinsUpdateBox

type ChannelPinsUpdateBox struct {
	// ChannelID snowflake	the id of the channel
	ChannelID Snowflake `json:"channel_id"`

	// LastPinTimestamp	ISO8601 timestamp	the time at which the most recent pinned message was pinned
	LastPinTimestamp resource.Timestamp `json:"last_pin_timestamp,omitempty"` // ?|
	Ctx              context.Context    `json:"-"`
}

ChannelPinsUpdateBox message was pinned or unpinned

type ChannelUpdateBox

type ChannelUpdateBox struct {
	Channel *resource.Channel `json:"channel"`
	Ctx     context.Context   `json:"-"`
}

ChannelUpdateBox channel was updated

type GuildBanAddBox

type GuildBanAddBox struct {
	User *resource.User  `json:"user"`
	Ctx  context.Context `json:"-"`
}

GuildBanAddBox user was banned from a guild

type GuildBanRemoveBox

type GuildBanRemoveBox struct {
	User *resource.User  `json:"user"`
	Ctx  context.Context `json:"-"`
}

GuildBanRemoveBox user was unbanned from a guild

type GuildCreateBox

type GuildCreateBox struct {
	Guild *resource.Guild `json:"guild"`
	Ctx   context.Context `json:"-"`
}

GuildCreateBox This event can be sent in three different scenarios:

  1. When a user is initially connecting, to lazily load and backfill information for all unavailable guilds sent in the Ready event.
  2. When a Guild becomes available again to the client.
  3. When the current user joins a new Guild.

type GuildDeleteBox

type GuildDeleteBox struct {
	UnavailableGuild *resource.GuildUnavailable `json:"guild_unavailable"`
	Ctx              context.Context            `json:"-"`
}

GuildDeleteBox guild became unavailable, or user left/was removed from a guild

type GuildEmojisUpdateBox

type GuildEmojisUpdateBox struct {
	GuildID Snowflake         `json:"guild_id"`
	Emojis  []*resource.Emoji `json:"emojis"`
	Ctx     context.Context   `json:"-"`
}

GuildEmojisUpdateBox guild emojis were updated

type GuildIntegrationsUpdateBox

type GuildIntegrationsUpdateBox struct {
	GuildID Snowflake       `json:"guild_id"`
	Ctx     context.Context `json:"-"`
}

GuildIntegrationsUpdateBox guild integration was updated

type GuildMemberAddBox

type GuildMemberAddBox struct {
	Member *resource.Member `json:"member"`
	Ctx    context.Context  `json:"-"`
}

GuildMemberAddBox new user joined a guild

type GuildMemberRemoveBox

type GuildMemberRemoveBox struct {
	GuildID Snowflake       `json:"guild_id"`
	User    *resource.User  `json:"user"`
	Ctx     context.Context `json:"-"`
}

GuildMemberRemoveBox user was removed from a guild

type GuildMemberUpdateBox

type GuildMemberUpdateBox struct {
	GuildID Snowflake        `json:"guild_id"`
	Roles   []*resource.Role `json:"roles"`
	User    *resource.User   `json:"user"`
	Nick    string           `json:"nick"`
	Ctx     context.Context  `json:"-"`
}

GuildMemberUpdateBox guild member was updated

type GuildMembersChunkBox

type GuildMembersChunkBox struct {
	GuildID Snowflake          `json:"guild_id"`
	Members []*resource.Member `json:"members"`
	Ctx     context.Context    `json:"-"`
}

GuildMembersChunkBox response to Request Guild Members

type GuildRoleCreateBox

type GuildRoleCreateBox struct {
	GuildID Snowflake       `json:"guild_id"`
	Role    *resource.Role  `json:"role"`
	Ctx     context.Context `json:"-"`
}

GuildRoleCreateBox guild role was created

type GuildRoleDeleteBox

type GuildRoleDeleteBox struct {
	GuildID Snowflake       `json:"guild_id"`
	RoleID  Snowflake       `json:"role_id"`
	Ctx     context.Context `json:"-"`
}

GuildRoleDeleteBox guild role was deleted

type GuildRoleUpdateBox

type GuildRoleUpdateBox struct {
	GuildID Snowflake       `json:"guild_id"`
	Role    *resource.Role  `json:"role"`
	Ctx     context.Context `json:"-"`
}

GuildRoleUpdateBox guild role was updated

type GuildUpdateBox

type GuildUpdateBox struct {
	Guild *resource.Guild `json:"guild"`
	Ctx   context.Context `json:"-"`
}

GuildUpdateBox guild was updated

type HelloBox

type HelloBox struct {
	HeartbeatInterval uint            `json:"heartbeat_interval"`
	Trace             []string        `json:"_trace"`
	Ctx               context.Context `json:"-"`
}

HelloBox defines the heartbeat interval

type InvalidSessionBox

type InvalidSessionBox struct {
	Ctx context.Context `json:"-"`
}

InvalidSessionBox failure response to Identify or Resume or invalid active session

type MessageCreateBox

type MessageCreateBox struct {
	Message *resource.Message
	Ctx     context.Context `json:"-"`
}

MessageCreateBox message was created

type MessageDeleteBox

type MessageDeleteBox struct {
	MessageID Snowflake       `json:"id"`
	ChannelID Snowflake       `json:"channel_id"`
	Ctx       context.Context `json:"-"`
}

MessageDeleteBox message was deleted

type MessageDeleteBulkBox

type MessageDeleteBulkBox struct {
	MessageIDs []Snowflake     `json:"ids"`
	ChannelID  Snowflake       `json:"channel_id"`
	Ctx        context.Context `json:"-"`
}

MessageDeleteBulkBox multiple messages were deleted at once

type MessageReactionAddBox

type MessageReactionAddBox struct {
	UserID    Snowflake `json:"user_id"`
	ChannelID Snowflake `json:"channel_id"`
	MessageID Snowflake `json:"message_id"`
	// PartialEmoji id and name. id might be nil
	PartialEmoji *resource.Emoji `json:"emoji"`
	Ctx          context.Context `json:"-"`
}

MessageReactionAddBox user reacted to a message

type MessageReactionRemoveAllBox

type MessageReactionRemoveAllBox struct {
	ChannelID Snowflake       `json:"channel_id"`
	MessageID Snowflake       `json:"id"`
	Ctx       context.Context `json:"-"`
}

MessageReactionRemoveAllBox all reactions were explicitly removed from a message

type MessageReactionRemoveBox

type MessageReactionRemoveBox struct {
	UserID    Snowflake `json:"user_id"`
	ChannelID Snowflake `json:"channel_id"`
	MessageID Snowflake `json:"message_id"`
	// PartialEmoji id and name. id might be nil
	PartialEmoji *resource.Emoji `json:"emoji"`
	Ctx          context.Context `json:"-"`
}

MessageReactionRemoveBox user removed a reaction from a message

type MessageUpdateBox

type MessageUpdateBox struct {
	Message *resource.Message
	Ctx     context.Context `json:"-"`
}

MessageUpdateBox message was edited

type PresenceUpdateBox

type PresenceUpdateBox struct {
	User    *resource.User         `json:"user"`
	RoleIDs []Snowflake            `json:"roles"`
	Game    *resource.UserActivity `json:"game"`
	GuildID Snowflake              `json:"guild_id"`

	// Status either "idle", "dnd", "online", or "offline"
	// TODO: constants somewhere..
	Status string          `json:"status"`
	Ctx    context.Context `json:"-"`
}

PresenceUpdateBox user's presence was updated in a guild

type ReadyBox

type ReadyBox struct {
	APIVersion int                          `json:"v"`
	User       *resource.User               `json:"user"`
	Guilds     []*resource.GuildUnavailable `json:"guilds"`

	// not really needed, as it is handled on the socket layer.
	SessionID string   `json:"session_id"`
	Trace     []string `json:"_trace"`

	sync.RWMutex `json:"-"`
	Ctx          context.Context `json:"-"`
}

ReadyBox contains the initial state information

type ResumedBox

type ResumedBox struct {
	Trace []string        `json:"_trace"`
	Ctx   context.Context `json:"-"`
}

ResumedBox response to Resume

type TypingStartBox

type TypingStartBox struct {
	ChannelID     Snowflake       `json:"channel_id"`
	UserID        Snowflake       `json:"user_id"`
	TimestampUnix int             `json:"timestamp"`
	Ctx           context.Context `json:"-"`
}

TypingStartBox user started typing in a channel

type UserUpdateBox

type UserUpdateBox struct {
	User *resource.User  `json:"user"`
	Ctx  context.Context `json:"-"`
}

UserUpdateBox properties about a user changed

type VoiceServerUpdateBox

type VoiceServerUpdateBox struct {
	Token    string          `json:"token"`
	GuildID  Snowflake       `json:"guild_id"`
	Endpoint string          `json:"endpoint"`
	Ctx      context.Context `json:"-"`
}

VoiceServerUpdateBox guild's voice server was updated Sent when a guild's voice server is updated. This is sent when initially connecting to voice, and when the current voice instance fails over to a new server.

type VoiceStateUpdateBox

type VoiceStateUpdateBox struct {
	VoiceState *resource.VoiceState `json:"voice_state"`
	Ctx        context.Context      `json:"-"`
}

VoiceStateUpdateBox someone joined, left, or moved a voice channel

type WebhooksUpdateBox

type WebhooksUpdateBox struct {
	GuildID   Snowflake       `json:"guild_id"`
	ChannelID Snowflake       `json:"channel_id"`
	Ctx       context.Context `json:"-"`
}

WebhooksUpdateBox guild channel webhook was created, update, or deleted

Jump to

Keyboard shortcuts

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