1package discordgo
2
3import (
4	"encoding/json"
5)
6
7// This file contains all the possible structs that can be
8// handled by AddHandler/EventHandler.
9// DO NOT ADD ANYTHING BUT EVENT HANDLER STRUCTS TO THIS FILE.
10//go:generate go run tools/cmd/eventhandlers/main.go
11
12// Connect is the data for a Connect event.
13// This is a synthetic event and is not dispatched by Discord.
14type Connect struct{}
15
16// Disconnect is the data for a Disconnect event.
17// This is a synthetic event and is not dispatched by Discord.
18type Disconnect struct{}
19
20// RateLimit is the data for a RateLimit event.
21// This is a synthetic event and is not dispatched by Discord.
22type RateLimit struct {
23	*TooManyRequests
24	URL string
25}
26
27// Event provides a basic initial struct for all websocket events.
28type Event struct {
29	Operation int             `json:"op"`
30	Sequence  int64           `json:"s"`
31	Type      string          `json:"t"`
32	RawData   json.RawMessage `json:"d"`
33	// Struct contains one of the other types in this file.
34	Struct interface{} `json:"-"`
35}
36
37// A Ready stores all data for the websocket READY event.
38type Ready struct {
39	Version         int          `json:"v"`
40	SessionID       string       `json:"session_id"`
41	User            *User        `json:"user"`
42	ReadState       []*ReadState `json:"read_state"`
43	PrivateChannels []*Channel   `json:"private_channels"`
44	Guilds          []*Guild     `json:"guilds"`
45
46	// Undocumented fields
47	Settings          *Settings            `json:"user_settings"`
48	UserGuildSettings []*UserGuildSettings `json:"user_guild_settings"`
49	Relationships     []*Relationship      `json:"relationships"`
50	Presences         []*Presence          `json:"presences"`
51	Notes             map[string]string    `json:"notes"`
52}
53
54// ChannelCreate is the data for a ChannelCreate event.
55type ChannelCreate struct {
56	*Channel
57}
58
59// ChannelUpdate is the data for a ChannelUpdate event.
60type ChannelUpdate struct {
61	*Channel
62}
63
64// ChannelDelete is the data for a ChannelDelete event.
65type ChannelDelete struct {
66	*Channel
67}
68
69// ChannelPinsUpdate stores data for a ChannelPinsUpdate event.
70type ChannelPinsUpdate struct {
71	LastPinTimestamp string `json:"last_pin_timestamp"`
72	ChannelID        string `json:"channel_id"`
73	GuildID          string `json:"guild_id,omitempty"`
74}
75
76// GuildCreate is the data for a GuildCreate event.
77type GuildCreate struct {
78	*Guild
79}
80
81// GuildUpdate is the data for a GuildUpdate event.
82type GuildUpdate struct {
83	*Guild
84}
85
86// GuildDelete is the data for a GuildDelete event.
87type GuildDelete struct {
88	*Guild
89}
90
91// GuildBanAdd is the data for a GuildBanAdd event.
92type GuildBanAdd struct {
93	User    *User  `json:"user"`
94	GuildID string `json:"guild_id"`
95}
96
97// GuildBanRemove is the data for a GuildBanRemove event.
98type GuildBanRemove struct {
99	User    *User  `json:"user"`
100	GuildID string `json:"guild_id"`
101}
102
103// GuildMemberAdd is the data for a GuildMemberAdd event.
104type GuildMemberAdd struct {
105	*Member
106}
107
108// GuildMemberUpdate is the data for a GuildMemberUpdate event.
109type GuildMemberUpdate struct {
110	*Member
111}
112
113// GuildMemberRemove is the data for a GuildMemberRemove event.
114type GuildMemberRemove struct {
115	*Member
116}
117
118// GuildRoleCreate is the data for a GuildRoleCreate event.
119type GuildRoleCreate struct {
120	*GuildRole
121}
122
123// GuildRoleUpdate is the data for a GuildRoleUpdate event.
124type GuildRoleUpdate struct {
125	*GuildRole
126}
127
128// A GuildRoleDelete is the data for a GuildRoleDelete event.
129type GuildRoleDelete struct {
130	RoleID  string `json:"role_id"`
131	GuildID string `json:"guild_id"`
132}
133
134// A GuildEmojisUpdate is the data for a guild emoji update event.
135type GuildEmojisUpdate struct {
136	GuildID string   `json:"guild_id"`
137	Emojis  []*Emoji `json:"emojis"`
138}
139
140// A GuildMembersChunk is the data for a GuildMembersChunk event.
141type GuildMembersChunk struct {
142	GuildID    string      `json:"guild_id"`
143	Members    []*Member   `json:"members"`
144	ChunkIndex int         `json:"chunk_index"`
145	ChunkCount int         `json:"chunk_count"`
146	Presences  []*Presence `json:"presences,omitempty"`
147}
148
149// GuildIntegrationsUpdate is the data for a GuildIntegrationsUpdate event.
150type GuildIntegrationsUpdate struct {
151	GuildID string `json:"guild_id"`
152}
153
154// MessageAck is the data for a MessageAck event.
155type MessageAck struct {
156	MessageID string `json:"message_id"`
157	ChannelID string `json:"channel_id"`
158}
159
160// MessageCreate is the data for a MessageCreate event.
161type MessageCreate struct {
162	*Message
163}
164
165// MessageUpdate is the data for a MessageUpdate event.
166type MessageUpdate struct {
167	*Message
168	// BeforeUpdate will be nil if the Message was not previously cached in the state cache.
169	BeforeUpdate *Message `json:"-"`
170}
171
172// MessageDelete is the data for a MessageDelete event.
173type MessageDelete struct {
174	*Message
175	BeforeDelete *Message `json:"-"`
176}
177
178// MessageReactionAdd is the data for a MessageReactionAdd event.
179type MessageReactionAdd struct {
180	*MessageReaction
181}
182
183// MessageReactionRemove is the data for a MessageReactionRemove event.
184type MessageReactionRemove struct {
185	*MessageReaction
186}
187
188// MessageReactionRemoveAll is the data for a MessageReactionRemoveAll event.
189type MessageReactionRemoveAll struct {
190	*MessageReaction
191}
192
193// PresencesReplace is the data for a PresencesReplace event.
194type PresencesReplace []*Presence
195
196// PresenceUpdate is the data for a PresenceUpdate event.
197type PresenceUpdate struct {
198	Presence
199	GuildID string `json:"guild_id"`
200}
201
202// Resumed is the data for a Resumed event.
203type Resumed struct {
204	Trace []string `json:"_trace"`
205}
206
207// RelationshipAdd is the data for a RelationshipAdd event.
208type RelationshipAdd struct {
209	*Relationship
210}
211
212// RelationshipRemove is the data for a RelationshipRemove event.
213type RelationshipRemove struct {
214	*Relationship
215}
216
217// TypingStart is the data for a TypingStart event.
218type TypingStart struct {
219	UserID    string `json:"user_id"`
220	ChannelID string `json:"channel_id"`
221	GuildID   string `json:"guild_id,omitempty"`
222	Timestamp int    `json:"timestamp"`
223}
224
225// UserUpdate is the data for a UserUpdate event.
226type UserUpdate struct {
227	*User
228}
229
230// UserSettingsUpdate is the data for a UserSettingsUpdate event.
231type UserSettingsUpdate map[string]interface{}
232
233// UserGuildSettingsUpdate is the data for a UserGuildSettingsUpdate event.
234type UserGuildSettingsUpdate struct {
235	*UserGuildSettings
236}
237
238// UserNoteUpdate is the data for a UserNoteUpdate event.
239type UserNoteUpdate struct {
240	ID   string `json:"id"`
241	Note string `json:"note"`
242}
243
244// VoiceServerUpdate is the data for a VoiceServerUpdate event.
245type VoiceServerUpdate struct {
246	Token    string `json:"token"`
247	GuildID  string `json:"guild_id"`
248	Endpoint string `json:"endpoint"`
249}
250
251// VoiceStateUpdate is the data for a VoiceStateUpdate event.
252type VoiceStateUpdate struct {
253	*VoiceState
254	// BeforeUpdate will be nil if the VoiceState was not previously cached in the state cache.
255	BeforeUpdate *VoiceState `json:"-"`
256}
257
258// MessageDeleteBulk is the data for a MessageDeleteBulk event
259type MessageDeleteBulk struct {
260	Messages  []string `json:"ids"`
261	ChannelID string   `json:"channel_id"`
262	GuildID   string   `json:"guild_id"`
263}
264
265// WebhooksUpdate is the data for a WebhooksUpdate event
266type WebhooksUpdate struct {
267	GuildID   string `json:"guild_id"`
268	ChannelID string `json:"channel_id"`
269}
270