events.go 6.4 KB

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