events.go 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  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. }
  44. // ChannelCreate is the data for a ChannelCreate event.
  45. type ChannelCreate struct {
  46. *Channel
  47. }
  48. // ChannelUpdate is the data for a ChannelUpdate event.
  49. type ChannelUpdate struct {
  50. *Channel
  51. }
  52. // ChannelDelete is the data for a ChannelDelete event.
  53. type ChannelDelete struct {
  54. *Channel
  55. }
  56. // ChannelPinsUpdate stores data for a ChannelPinsUpdate event.
  57. type ChannelPinsUpdate struct {
  58. LastPinTimestamp string `json:"last_pin_timestamp"`
  59. ChannelID string `json:"channel_id"`
  60. }
  61. // GuildCreate is the data for a GuildCreate event.
  62. type GuildCreate struct {
  63. *Guild
  64. }
  65. // GuildUpdate is the data for a GuildUpdate event.
  66. type GuildUpdate struct {
  67. *Guild
  68. }
  69. // GuildDelete is the data for a GuildDelete event.
  70. type GuildDelete struct {
  71. *Guild
  72. }
  73. // GuildBanAdd is the data for a GuildBanAdd event.
  74. type GuildBanAdd struct {
  75. User *User `json:"user"`
  76. GuildID string `json:"guild_id"`
  77. }
  78. // GuildBanRemove is the data for a GuildBanRemove event.
  79. type GuildBanRemove struct {
  80. User *User `json:"user"`
  81. GuildID string `json:"guild_id"`
  82. }
  83. // GuildMemberAdd is the data for a GuildMemberAdd event.
  84. type GuildMemberAdd struct {
  85. *Member
  86. }
  87. // GuildMemberUpdate is the data for a GuildMemberUpdate event.
  88. type GuildMemberUpdate struct {
  89. *Member
  90. }
  91. // GuildMemberRemove is the data for a GuildMemberRemove event.
  92. type GuildMemberRemove struct {
  93. *Member
  94. }
  95. // GuildRoleCreate is the data for a GuildRoleCreate event.
  96. type GuildRoleCreate struct {
  97. *GuildRole
  98. }
  99. // GuildRoleUpdate is the data for a GuildRoleUpdate event.
  100. type GuildRoleUpdate struct {
  101. *GuildRole
  102. }
  103. // A GuildRoleDelete is the data for a GuildRoleDelete event.
  104. type GuildRoleDelete struct {
  105. RoleID string `json:"role_id"`
  106. GuildID string `json:"guild_id"`
  107. }
  108. // A GuildEmojisUpdate is the data for a guild emoji update event.
  109. type GuildEmojisUpdate struct {
  110. GuildID string `json:"guild_id"`
  111. Emojis []*Emoji `json:"emojis"`
  112. }
  113. // A GuildMembersChunk is the data for a GuildMembersChunk event.
  114. type GuildMembersChunk struct {
  115. GuildID string `json:"guild_id"`
  116. Members []*Member `json:"members"`
  117. }
  118. // GuildIntegrationsUpdate is the data for a GuildIntegrationsUpdate event.
  119. type GuildIntegrationsUpdate struct {
  120. GuildID string `json:"guild_id"`
  121. }
  122. // MessageAck is the data for a MessageAck event.
  123. type MessageAck struct {
  124. MessageID string `json:"message_id"`
  125. ChannelID string `json:"channel_id"`
  126. }
  127. // MessageCreate is the data for a MessageCreate event.
  128. type MessageCreate struct {
  129. *Message
  130. }
  131. // MessageUpdate is the data for a MessageUpdate event.
  132. type MessageUpdate struct {
  133. *Message
  134. }
  135. // MessageDelete is the data for a MessageDelete event.
  136. type MessageDelete struct {
  137. *Message
  138. }
  139. // MessageReactionAdd is the data for a MessageReactionAdd event.
  140. type MessageReactionAdd struct {
  141. *MessageReaction
  142. }
  143. // MessageReactionRemove is the data for a MessageReactionRemove event.
  144. type MessageReactionRemove struct {
  145. *MessageReaction
  146. }
  147. // PresencesReplace is the data for a PresencesReplace event.
  148. type PresencesReplace []*Presence
  149. // PresenceUpdate is the data for a PresenceUpdate event.
  150. type PresenceUpdate struct {
  151. Presence
  152. GuildID string `json:"guild_id"`
  153. Roles []string `json:"roles"`
  154. }
  155. // Resumed is the data for a Resumed event.
  156. type Resumed struct {
  157. Trace []string `json:"_trace"`
  158. }
  159. // RelationshipAdd is the data for a RelationshipAdd event.
  160. type RelationshipAdd struct {
  161. *Relationship
  162. }
  163. // RelationshipRemove is the data for a RelationshipRemove event.
  164. type RelationshipRemove struct {
  165. *Relationship
  166. }
  167. // TypingStart is the data for a TypingStart event.
  168. type TypingStart struct {
  169. UserID string `json:"user_id"`
  170. ChannelID string `json:"channel_id"`
  171. Timestamp int `json:"timestamp"`
  172. }
  173. // UserUpdate is the data for a UserUpdate event.
  174. type UserUpdate struct {
  175. *User
  176. }
  177. // UserSettingsUpdate is the data for a UserSettingsUpdate event.
  178. type UserSettingsUpdate map[string]interface{}
  179. // UserGuildSettingsUpdate is the data for a UserGuildSettingsUpdate event.
  180. type UserGuildSettingsUpdate struct {
  181. *UserGuildSettings
  182. }
  183. // VoiceServerUpdate is the data for a VoiceServerUpdate event.
  184. type VoiceServerUpdate struct {
  185. Token string `json:"token"`
  186. GuildID string `json:"guild_id"`
  187. Endpoint string `json:"endpoint"`
  188. }
  189. // VoiceStateUpdate is the data for a VoiceStateUpdate event.
  190. type VoiceStateUpdate struct {
  191. *VoiceState
  192. }
  193. // MessageDeleteBulk is the data for a MessageDeleteBulk event
  194. type MessageDeleteBulk struct {
  195. Messages []string `json:"ids"`
  196. ChannelID string `json:"channel_id"`
  197. }