eventhandlers.go 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982
  1. // Code generated by \"eventhandlers\"; DO NOT EDIT
  2. // See events.go
  3. package discordgo
  4. // Following are all the event types.
  5. // Event type values are used to match the events returned by Discord.
  6. // EventTypes surrounded by __ are synthetic and are internal to DiscordGo.
  7. const (
  8. channelCreateEventType = "CHANNEL_CREATE"
  9. channelDeleteEventType = "CHANNEL_DELETE"
  10. channelPinsUpdateEventType = "CHANNEL_PINS_UPDATE"
  11. channelUpdateEventType = "CHANNEL_UPDATE"
  12. connectEventType = "__CONNECT__"
  13. disconnectEventType = "__DISCONNECT__"
  14. eventEventType = "__EVENT__"
  15. guildBanAddEventType = "GUILD_BAN_ADD"
  16. guildBanRemoveEventType = "GUILD_BAN_REMOVE"
  17. guildCreateEventType = "GUILD_CREATE"
  18. guildDeleteEventType = "GUILD_DELETE"
  19. guildEmojisUpdateEventType = "GUILD_EMOJIS_UPDATE"
  20. guildIntegrationsUpdateEventType = "GUILD_INTEGRATIONS_UPDATE"
  21. guildMemberAddEventType = "GUILD_MEMBER_ADD"
  22. guildMemberRemoveEventType = "GUILD_MEMBER_REMOVE"
  23. guildMemberUpdateEventType = "GUILD_MEMBER_UPDATE"
  24. guildMembersChunkEventType = "GUILD_MEMBERS_CHUNK"
  25. guildRoleCreateEventType = "GUILD_ROLE_CREATE"
  26. guildRoleDeleteEventType = "GUILD_ROLE_DELETE"
  27. guildRoleUpdateEventType = "GUILD_ROLE_UPDATE"
  28. guildUpdateEventType = "GUILD_UPDATE"
  29. messageAckEventType = "MESSAGE_ACK"
  30. messageCreateEventType = "MESSAGE_CREATE"
  31. messageDeleteEventType = "MESSAGE_DELETE"
  32. messageDeleteBulkEventType = "MESSAGE_DELETE_BULK"
  33. messageReactionAddEventType = "MESSAGE_REACTION_ADD"
  34. messageReactionRemoveEventType = "MESSAGE_REACTION_REMOVE"
  35. messageUpdateEventType = "MESSAGE_UPDATE"
  36. presenceUpdateEventType = "PRESENCE_UPDATE"
  37. presencesReplaceEventType = "PRESENCES_REPLACE"
  38. rateLimitEventType = "__RATE_LIMIT__"
  39. readyEventType = "READY"
  40. relationshipAddEventType = "RELATIONSHIP_ADD"
  41. relationshipRemoveEventType = "RELATIONSHIP_REMOVE"
  42. resumedEventType = "RESUMED"
  43. typingStartEventType = "TYPING_START"
  44. userGuildSettingsUpdateEventType = "USER_GUILD_SETTINGS_UPDATE"
  45. userSettingsUpdateEventType = "USER_SETTINGS_UPDATE"
  46. userUpdateEventType = "USER_UPDATE"
  47. voiceServerUpdateEventType = "VOICE_SERVER_UPDATE"
  48. voiceStateUpdateEventType = "VOICE_STATE_UPDATE"
  49. )
  50. // channelCreateEventHandler is an event handler for ChannelCreate events.
  51. type channelCreateEventHandler func(*Session, *ChannelCreate)
  52. // Type returns the event type for ChannelCreate events.
  53. func (eh channelCreateEventHandler) Type() string {
  54. return channelCreateEventType
  55. }
  56. // New returns a new instance of ChannelCreate.
  57. func (eh channelCreateEventHandler) New() interface{} {
  58. return &ChannelCreate{}
  59. }
  60. // Handle is the handler for ChannelCreate events.
  61. func (eh channelCreateEventHandler) Handle(s *Session, i interface{}) {
  62. if t, ok := i.(*ChannelCreate); ok {
  63. eh(s, t)
  64. }
  65. }
  66. // channelDeleteEventHandler is an event handler for ChannelDelete events.
  67. type channelDeleteEventHandler func(*Session, *ChannelDelete)
  68. // Type returns the event type for ChannelDelete events.
  69. func (eh channelDeleteEventHandler) Type() string {
  70. return channelDeleteEventType
  71. }
  72. // New returns a new instance of ChannelDelete.
  73. func (eh channelDeleteEventHandler) New() interface{} {
  74. return &ChannelDelete{}
  75. }
  76. // Handle is the handler for ChannelDelete events.
  77. func (eh channelDeleteEventHandler) Handle(s *Session, i interface{}) {
  78. if t, ok := i.(*ChannelDelete); ok {
  79. eh(s, t)
  80. }
  81. }
  82. // channelPinsUpdateEventHandler is an event handler for ChannelPinsUpdate events.
  83. type channelPinsUpdateEventHandler func(*Session, *ChannelPinsUpdate)
  84. // Type returns the event type for ChannelPinsUpdate events.
  85. func (eh channelPinsUpdateEventHandler) Type() string {
  86. return channelPinsUpdateEventType
  87. }
  88. // New returns a new instance of ChannelPinsUpdate.
  89. func (eh channelPinsUpdateEventHandler) New() interface{} {
  90. return &ChannelPinsUpdate{}
  91. }
  92. // Handle is the handler for ChannelPinsUpdate events.
  93. func (eh channelPinsUpdateEventHandler) Handle(s *Session, i interface{}) {
  94. if t, ok := i.(*ChannelPinsUpdate); ok {
  95. eh(s, t)
  96. }
  97. }
  98. // channelUpdateEventHandler is an event handler for ChannelUpdate events.
  99. type channelUpdateEventHandler func(*Session, *ChannelUpdate)
  100. // Type returns the event type for ChannelUpdate events.
  101. func (eh channelUpdateEventHandler) Type() string {
  102. return channelUpdateEventType
  103. }
  104. // New returns a new instance of ChannelUpdate.
  105. func (eh channelUpdateEventHandler) New() interface{} {
  106. return &ChannelUpdate{}
  107. }
  108. // Handle is the handler for ChannelUpdate events.
  109. func (eh channelUpdateEventHandler) Handle(s *Session, i interface{}) {
  110. if t, ok := i.(*ChannelUpdate); ok {
  111. eh(s, t)
  112. }
  113. }
  114. // connectEventHandler is an event handler for Connect events.
  115. type connectEventHandler func(*Session, *Connect)
  116. // Type returns the event type for Connect events.
  117. func (eh connectEventHandler) Type() string {
  118. return connectEventType
  119. }
  120. // Handle is the handler for Connect events.
  121. func (eh connectEventHandler) Handle(s *Session, i interface{}) {
  122. if t, ok := i.(*Connect); ok {
  123. eh(s, t)
  124. }
  125. }
  126. // disconnectEventHandler is an event handler for Disconnect events.
  127. type disconnectEventHandler func(*Session, *Disconnect)
  128. // Type returns the event type for Disconnect events.
  129. func (eh disconnectEventHandler) Type() string {
  130. return disconnectEventType
  131. }
  132. // Handle is the handler for Disconnect events.
  133. func (eh disconnectEventHandler) Handle(s *Session, i interface{}) {
  134. if t, ok := i.(*Disconnect); ok {
  135. eh(s, t)
  136. }
  137. }
  138. // eventEventHandler is an event handler for Event events.
  139. type eventEventHandler func(*Session, *Event)
  140. // Type returns the event type for Event events.
  141. func (eh eventEventHandler) Type() string {
  142. return eventEventType
  143. }
  144. // Handle is the handler for Event events.
  145. func (eh eventEventHandler) Handle(s *Session, i interface{}) {
  146. if t, ok := i.(*Event); ok {
  147. eh(s, t)
  148. }
  149. }
  150. // guildBanAddEventHandler is an event handler for GuildBanAdd events.
  151. type guildBanAddEventHandler func(*Session, *GuildBanAdd)
  152. // Type returns the event type for GuildBanAdd events.
  153. func (eh guildBanAddEventHandler) Type() string {
  154. return guildBanAddEventType
  155. }
  156. // New returns a new instance of GuildBanAdd.
  157. func (eh guildBanAddEventHandler) New() interface{} {
  158. return &GuildBanAdd{}
  159. }
  160. // Handle is the handler for GuildBanAdd events.
  161. func (eh guildBanAddEventHandler) Handle(s *Session, i interface{}) {
  162. if t, ok := i.(*GuildBanAdd); ok {
  163. eh(s, t)
  164. }
  165. }
  166. // guildBanRemoveEventHandler is an event handler for GuildBanRemove events.
  167. type guildBanRemoveEventHandler func(*Session, *GuildBanRemove)
  168. // Type returns the event type for GuildBanRemove events.
  169. func (eh guildBanRemoveEventHandler) Type() string {
  170. return guildBanRemoveEventType
  171. }
  172. // New returns a new instance of GuildBanRemove.
  173. func (eh guildBanRemoveEventHandler) New() interface{} {
  174. return &GuildBanRemove{}
  175. }
  176. // Handle is the handler for GuildBanRemove events.
  177. func (eh guildBanRemoveEventHandler) Handle(s *Session, i interface{}) {
  178. if t, ok := i.(*GuildBanRemove); ok {
  179. eh(s, t)
  180. }
  181. }
  182. // guildCreateEventHandler is an event handler for GuildCreate events.
  183. type guildCreateEventHandler func(*Session, *GuildCreate)
  184. // Type returns the event type for GuildCreate events.
  185. func (eh guildCreateEventHandler) Type() string {
  186. return guildCreateEventType
  187. }
  188. // New returns a new instance of GuildCreate.
  189. func (eh guildCreateEventHandler) New() interface{} {
  190. return &GuildCreate{}
  191. }
  192. // Handle is the handler for GuildCreate events.
  193. func (eh guildCreateEventHandler) Handle(s *Session, i interface{}) {
  194. if t, ok := i.(*GuildCreate); ok {
  195. eh(s, t)
  196. }
  197. }
  198. // guildDeleteEventHandler is an event handler for GuildDelete events.
  199. type guildDeleteEventHandler func(*Session, *GuildDelete)
  200. // Type returns the event type for GuildDelete events.
  201. func (eh guildDeleteEventHandler) Type() string {
  202. return guildDeleteEventType
  203. }
  204. // New returns a new instance of GuildDelete.
  205. func (eh guildDeleteEventHandler) New() interface{} {
  206. return &GuildDelete{}
  207. }
  208. // Handle is the handler for GuildDelete events.
  209. func (eh guildDeleteEventHandler) Handle(s *Session, i interface{}) {
  210. if t, ok := i.(*GuildDelete); ok {
  211. eh(s, t)
  212. }
  213. }
  214. // guildEmojisUpdateEventHandler is an event handler for GuildEmojisUpdate events.
  215. type guildEmojisUpdateEventHandler func(*Session, *GuildEmojisUpdate)
  216. // Type returns the event type for GuildEmojisUpdate events.
  217. func (eh guildEmojisUpdateEventHandler) Type() string {
  218. return guildEmojisUpdateEventType
  219. }
  220. // New returns a new instance of GuildEmojisUpdate.
  221. func (eh guildEmojisUpdateEventHandler) New() interface{} {
  222. return &GuildEmojisUpdate{}
  223. }
  224. // Handle is the handler for GuildEmojisUpdate events.
  225. func (eh guildEmojisUpdateEventHandler) Handle(s *Session, i interface{}) {
  226. if t, ok := i.(*GuildEmojisUpdate); ok {
  227. eh(s, t)
  228. }
  229. }
  230. // guildIntegrationsUpdateEventHandler is an event handler for GuildIntegrationsUpdate events.
  231. type guildIntegrationsUpdateEventHandler func(*Session, *GuildIntegrationsUpdate)
  232. // Type returns the event type for GuildIntegrationsUpdate events.
  233. func (eh guildIntegrationsUpdateEventHandler) Type() string {
  234. return guildIntegrationsUpdateEventType
  235. }
  236. // New returns a new instance of GuildIntegrationsUpdate.
  237. func (eh guildIntegrationsUpdateEventHandler) New() interface{} {
  238. return &GuildIntegrationsUpdate{}
  239. }
  240. // Handle is the handler for GuildIntegrationsUpdate events.
  241. func (eh guildIntegrationsUpdateEventHandler) Handle(s *Session, i interface{}) {
  242. if t, ok := i.(*GuildIntegrationsUpdate); ok {
  243. eh(s, t)
  244. }
  245. }
  246. // guildMemberAddEventHandler is an event handler for GuildMemberAdd events.
  247. type guildMemberAddEventHandler func(*Session, *GuildMemberAdd)
  248. // Type returns the event type for GuildMemberAdd events.
  249. func (eh guildMemberAddEventHandler) Type() string {
  250. return guildMemberAddEventType
  251. }
  252. // New returns a new instance of GuildMemberAdd.
  253. func (eh guildMemberAddEventHandler) New() interface{} {
  254. return &GuildMemberAdd{}
  255. }
  256. // Handle is the handler for GuildMemberAdd events.
  257. func (eh guildMemberAddEventHandler) Handle(s *Session, i interface{}) {
  258. if t, ok := i.(*GuildMemberAdd); ok {
  259. eh(s, t)
  260. }
  261. }
  262. // guildMemberRemoveEventHandler is an event handler for GuildMemberRemove events.
  263. type guildMemberRemoveEventHandler func(*Session, *GuildMemberRemove)
  264. // Type returns the event type for GuildMemberRemove events.
  265. func (eh guildMemberRemoveEventHandler) Type() string {
  266. return guildMemberRemoveEventType
  267. }
  268. // New returns a new instance of GuildMemberRemove.
  269. func (eh guildMemberRemoveEventHandler) New() interface{} {
  270. return &GuildMemberRemove{}
  271. }
  272. // Handle is the handler for GuildMemberRemove events.
  273. func (eh guildMemberRemoveEventHandler) Handle(s *Session, i interface{}) {
  274. if t, ok := i.(*GuildMemberRemove); ok {
  275. eh(s, t)
  276. }
  277. }
  278. // guildMemberUpdateEventHandler is an event handler for GuildMemberUpdate events.
  279. type guildMemberUpdateEventHandler func(*Session, *GuildMemberUpdate)
  280. // Type returns the event type for GuildMemberUpdate events.
  281. func (eh guildMemberUpdateEventHandler) Type() string {
  282. return guildMemberUpdateEventType
  283. }
  284. // New returns a new instance of GuildMemberUpdate.
  285. func (eh guildMemberUpdateEventHandler) New() interface{} {
  286. return &GuildMemberUpdate{}
  287. }
  288. // Handle is the handler for GuildMemberUpdate events.
  289. func (eh guildMemberUpdateEventHandler) Handle(s *Session, i interface{}) {
  290. if t, ok := i.(*GuildMemberUpdate); ok {
  291. eh(s, t)
  292. }
  293. }
  294. // guildMembersChunkEventHandler is an event handler for GuildMembersChunk events.
  295. type guildMembersChunkEventHandler func(*Session, *GuildMembersChunk)
  296. // Type returns the event type for GuildMembersChunk events.
  297. func (eh guildMembersChunkEventHandler) Type() string {
  298. return guildMembersChunkEventType
  299. }
  300. // New returns a new instance of GuildMembersChunk.
  301. func (eh guildMembersChunkEventHandler) New() interface{} {
  302. return &GuildMembersChunk{}
  303. }
  304. // Handle is the handler for GuildMembersChunk events.
  305. func (eh guildMembersChunkEventHandler) Handle(s *Session, i interface{}) {
  306. if t, ok := i.(*GuildMembersChunk); ok {
  307. eh(s, t)
  308. }
  309. }
  310. // guildRoleCreateEventHandler is an event handler for GuildRoleCreate events.
  311. type guildRoleCreateEventHandler func(*Session, *GuildRoleCreate)
  312. // Type returns the event type for GuildRoleCreate events.
  313. func (eh guildRoleCreateEventHandler) Type() string {
  314. return guildRoleCreateEventType
  315. }
  316. // New returns a new instance of GuildRoleCreate.
  317. func (eh guildRoleCreateEventHandler) New() interface{} {
  318. return &GuildRoleCreate{}
  319. }
  320. // Handle is the handler for GuildRoleCreate events.
  321. func (eh guildRoleCreateEventHandler) Handle(s *Session, i interface{}) {
  322. if t, ok := i.(*GuildRoleCreate); ok {
  323. eh(s, t)
  324. }
  325. }
  326. // guildRoleDeleteEventHandler is an event handler for GuildRoleDelete events.
  327. type guildRoleDeleteEventHandler func(*Session, *GuildRoleDelete)
  328. // Type returns the event type for GuildRoleDelete events.
  329. func (eh guildRoleDeleteEventHandler) Type() string {
  330. return guildRoleDeleteEventType
  331. }
  332. // New returns a new instance of GuildRoleDelete.
  333. func (eh guildRoleDeleteEventHandler) New() interface{} {
  334. return &GuildRoleDelete{}
  335. }
  336. // Handle is the handler for GuildRoleDelete events.
  337. func (eh guildRoleDeleteEventHandler) Handle(s *Session, i interface{}) {
  338. if t, ok := i.(*GuildRoleDelete); ok {
  339. eh(s, t)
  340. }
  341. }
  342. // guildRoleUpdateEventHandler is an event handler for GuildRoleUpdate events.
  343. type guildRoleUpdateEventHandler func(*Session, *GuildRoleUpdate)
  344. // Type returns the event type for GuildRoleUpdate events.
  345. func (eh guildRoleUpdateEventHandler) Type() string {
  346. return guildRoleUpdateEventType
  347. }
  348. // New returns a new instance of GuildRoleUpdate.
  349. func (eh guildRoleUpdateEventHandler) New() interface{} {
  350. return &GuildRoleUpdate{}
  351. }
  352. // Handle is the handler for GuildRoleUpdate events.
  353. func (eh guildRoleUpdateEventHandler) Handle(s *Session, i interface{}) {
  354. if t, ok := i.(*GuildRoleUpdate); ok {
  355. eh(s, t)
  356. }
  357. }
  358. // guildUpdateEventHandler is an event handler for GuildUpdate events.
  359. type guildUpdateEventHandler func(*Session, *GuildUpdate)
  360. // Type returns the event type for GuildUpdate events.
  361. func (eh guildUpdateEventHandler) Type() string {
  362. return guildUpdateEventType
  363. }
  364. // New returns a new instance of GuildUpdate.
  365. func (eh guildUpdateEventHandler) New() interface{} {
  366. return &GuildUpdate{}
  367. }
  368. // Handle is the handler for GuildUpdate events.
  369. func (eh guildUpdateEventHandler) Handle(s *Session, i interface{}) {
  370. if t, ok := i.(*GuildUpdate); ok {
  371. eh(s, t)
  372. }
  373. }
  374. // messageAckEventHandler is an event handler for MessageAck events.
  375. type messageAckEventHandler func(*Session, *MessageAck)
  376. // Type returns the event type for MessageAck events.
  377. func (eh messageAckEventHandler) Type() string {
  378. return messageAckEventType
  379. }
  380. // New returns a new instance of MessageAck.
  381. func (eh messageAckEventHandler) New() interface{} {
  382. return &MessageAck{}
  383. }
  384. // Handle is the handler for MessageAck events.
  385. func (eh messageAckEventHandler) Handle(s *Session, i interface{}) {
  386. if t, ok := i.(*MessageAck); ok {
  387. eh(s, t)
  388. }
  389. }
  390. // messageCreateEventHandler is an event handler for MessageCreate events.
  391. type messageCreateEventHandler func(*Session, *MessageCreate)
  392. // Type returns the event type for MessageCreate events.
  393. func (eh messageCreateEventHandler) Type() string {
  394. return messageCreateEventType
  395. }
  396. // New returns a new instance of MessageCreate.
  397. func (eh messageCreateEventHandler) New() interface{} {
  398. return &MessageCreate{}
  399. }
  400. // Handle is the handler for MessageCreate events.
  401. func (eh messageCreateEventHandler) Handle(s *Session, i interface{}) {
  402. if t, ok := i.(*MessageCreate); ok {
  403. eh(s, t)
  404. }
  405. }
  406. // messageDeleteEventHandler is an event handler for MessageDelete events.
  407. type messageDeleteEventHandler func(*Session, *MessageDelete)
  408. // Type returns the event type for MessageDelete events.
  409. func (eh messageDeleteEventHandler) Type() string {
  410. return messageDeleteEventType
  411. }
  412. // New returns a new instance of MessageDelete.
  413. func (eh messageDeleteEventHandler) New() interface{} {
  414. return &MessageDelete{}
  415. }
  416. // Handle is the handler for MessageDelete events.
  417. func (eh messageDeleteEventHandler) Handle(s *Session, i interface{}) {
  418. if t, ok := i.(*MessageDelete); ok {
  419. eh(s, t)
  420. }
  421. }
  422. // messageDeleteBulkEventHandler is an event handler for MessageDeleteBulk events.
  423. type messageDeleteBulkEventHandler func(*Session, *MessageDeleteBulk)
  424. // Type returns the event type for MessageDeleteBulk events.
  425. func (eh messageDeleteBulkEventHandler) Type() string {
  426. return messageDeleteBulkEventType
  427. }
  428. // New returns a new instance of MessageDeleteBulk.
  429. func (eh messageDeleteBulkEventHandler) New() interface{} {
  430. return &MessageDeleteBulk{}
  431. }
  432. // Handle is the handler for MessageDeleteBulk events.
  433. func (eh messageDeleteBulkEventHandler) Handle(s *Session, i interface{}) {
  434. if t, ok := i.(*MessageDeleteBulk); ok {
  435. eh(s, t)
  436. }
  437. }
  438. // messageReactionAddEventHandler is an event handler for MessageReactionAdd events.
  439. type messageReactionAddEventHandler func(*Session, *MessageReactionAdd)
  440. // Type returns the event type for MessageReactionAdd events.
  441. func (eh messageReactionAddEventHandler) Type() string {
  442. return messageReactionAddEventType
  443. }
  444. // New returns a new instance of MessageReactionAdd.
  445. func (eh messageReactionAddEventHandler) New() interface{} {
  446. return &MessageReactionAdd{}
  447. }
  448. // Handle is the handler for MessageReactionAdd events.
  449. func (eh messageReactionAddEventHandler) Handle(s *Session, i interface{}) {
  450. if t, ok := i.(*MessageReactionAdd); ok {
  451. eh(s, t)
  452. }
  453. }
  454. // messageReactionRemoveEventHandler is an event handler for MessageReactionRemove events.
  455. type messageReactionRemoveEventHandler func(*Session, *MessageReactionRemove)
  456. // Type returns the event type for MessageReactionRemove events.
  457. func (eh messageReactionRemoveEventHandler) Type() string {
  458. return messageReactionRemoveEventType
  459. }
  460. // New returns a new instance of MessageReactionRemove.
  461. func (eh messageReactionRemoveEventHandler) New() interface{} {
  462. return &MessageReactionRemove{}
  463. }
  464. // Handle is the handler for MessageReactionRemove events.
  465. func (eh messageReactionRemoveEventHandler) Handle(s *Session, i interface{}) {
  466. if t, ok := i.(*MessageReactionRemove); ok {
  467. eh(s, t)
  468. }
  469. }
  470. // messageUpdateEventHandler is an event handler for MessageUpdate events.
  471. type messageUpdateEventHandler func(*Session, *MessageUpdate)
  472. // Type returns the event type for MessageUpdate events.
  473. func (eh messageUpdateEventHandler) Type() string {
  474. return messageUpdateEventType
  475. }
  476. // New returns a new instance of MessageUpdate.
  477. func (eh messageUpdateEventHandler) New() interface{} {
  478. return &MessageUpdate{}
  479. }
  480. // Handle is the handler for MessageUpdate events.
  481. func (eh messageUpdateEventHandler) Handle(s *Session, i interface{}) {
  482. if t, ok := i.(*MessageUpdate); ok {
  483. eh(s, t)
  484. }
  485. }
  486. // presenceUpdateEventHandler is an event handler for PresenceUpdate events.
  487. type presenceUpdateEventHandler func(*Session, *PresenceUpdate)
  488. // Type returns the event type for PresenceUpdate events.
  489. func (eh presenceUpdateEventHandler) Type() string {
  490. return presenceUpdateEventType
  491. }
  492. // New returns a new instance of PresenceUpdate.
  493. func (eh presenceUpdateEventHandler) New() interface{} {
  494. return &PresenceUpdate{}
  495. }
  496. // Handle is the handler for PresenceUpdate events.
  497. func (eh presenceUpdateEventHandler) Handle(s *Session, i interface{}) {
  498. if t, ok := i.(*PresenceUpdate); ok {
  499. eh(s, t)
  500. }
  501. }
  502. // presencesReplaceEventHandler is an event handler for PresencesReplace events.
  503. type presencesReplaceEventHandler func(*Session, *PresencesReplace)
  504. // Type returns the event type for PresencesReplace events.
  505. func (eh presencesReplaceEventHandler) Type() string {
  506. return presencesReplaceEventType
  507. }
  508. // New returns a new instance of PresencesReplace.
  509. func (eh presencesReplaceEventHandler) New() interface{} {
  510. return &PresencesReplace{}
  511. }
  512. // Handle is the handler for PresencesReplace events.
  513. func (eh presencesReplaceEventHandler) Handle(s *Session, i interface{}) {
  514. if t, ok := i.(*PresencesReplace); ok {
  515. eh(s, t)
  516. }
  517. }
  518. // rateLimitEventHandler is an event handler for RateLimit events.
  519. type rateLimitEventHandler func(*Session, *RateLimit)
  520. // Type returns the event type for RateLimit events.
  521. func (eh rateLimitEventHandler) Type() string {
  522. return rateLimitEventType
  523. }
  524. // Handle is the handler for RateLimit events.
  525. func (eh rateLimitEventHandler) Handle(s *Session, i interface{}) {
  526. if t, ok := i.(*RateLimit); ok {
  527. eh(s, t)
  528. }
  529. }
  530. // readyEventHandler is an event handler for Ready events.
  531. type readyEventHandler func(*Session, *Ready)
  532. // Type returns the event type for Ready events.
  533. func (eh readyEventHandler) Type() string {
  534. return readyEventType
  535. }
  536. // New returns a new instance of Ready.
  537. func (eh readyEventHandler) New() interface{} {
  538. return &Ready{}
  539. }
  540. // Handle is the handler for Ready events.
  541. func (eh readyEventHandler) Handle(s *Session, i interface{}) {
  542. if t, ok := i.(*Ready); ok {
  543. eh(s, t)
  544. }
  545. }
  546. // relationshipAddEventHandler is an event handler for RelationshipAdd events.
  547. type relationshipAddEventHandler func(*Session, *RelationshipAdd)
  548. // Type returns the event type for RelationshipAdd events.
  549. func (eh relationshipAddEventHandler) Type() string {
  550. return relationshipAddEventType
  551. }
  552. // New returns a new instance of RelationshipAdd.
  553. func (eh relationshipAddEventHandler) New() interface{} {
  554. return &RelationshipAdd{}
  555. }
  556. // Handle is the handler for RelationshipAdd events.
  557. func (eh relationshipAddEventHandler) Handle(s *Session, i interface{}) {
  558. if t, ok := i.(*RelationshipAdd); ok {
  559. eh(s, t)
  560. }
  561. }
  562. // relationshipRemoveEventHandler is an event handler for RelationshipRemove events.
  563. type relationshipRemoveEventHandler func(*Session, *RelationshipRemove)
  564. // Type returns the event type for RelationshipRemove events.
  565. func (eh relationshipRemoveEventHandler) Type() string {
  566. return relationshipRemoveEventType
  567. }
  568. // New returns a new instance of RelationshipRemove.
  569. func (eh relationshipRemoveEventHandler) New() interface{} {
  570. return &RelationshipRemove{}
  571. }
  572. // Handle is the handler for RelationshipRemove events.
  573. func (eh relationshipRemoveEventHandler) Handle(s *Session, i interface{}) {
  574. if t, ok := i.(*RelationshipRemove); ok {
  575. eh(s, t)
  576. }
  577. }
  578. // resumedEventHandler is an event handler for Resumed events.
  579. type resumedEventHandler func(*Session, *Resumed)
  580. // Type returns the event type for Resumed events.
  581. func (eh resumedEventHandler) Type() string {
  582. return resumedEventType
  583. }
  584. // New returns a new instance of Resumed.
  585. func (eh resumedEventHandler) New() interface{} {
  586. return &Resumed{}
  587. }
  588. // Handle is the handler for Resumed events.
  589. func (eh resumedEventHandler) Handle(s *Session, i interface{}) {
  590. if t, ok := i.(*Resumed); ok {
  591. eh(s, t)
  592. }
  593. }
  594. // typingStartEventHandler is an event handler for TypingStart events.
  595. type typingStartEventHandler func(*Session, *TypingStart)
  596. // Type returns the event type for TypingStart events.
  597. func (eh typingStartEventHandler) Type() string {
  598. return typingStartEventType
  599. }
  600. // New returns a new instance of TypingStart.
  601. func (eh typingStartEventHandler) New() interface{} {
  602. return &TypingStart{}
  603. }
  604. // Handle is the handler for TypingStart events.
  605. func (eh typingStartEventHandler) Handle(s *Session, i interface{}) {
  606. if t, ok := i.(*TypingStart); ok {
  607. eh(s, t)
  608. }
  609. }
  610. // userGuildSettingsUpdateEventHandler is an event handler for UserGuildSettingsUpdate events.
  611. type userGuildSettingsUpdateEventHandler func(*Session, *UserGuildSettingsUpdate)
  612. // Type returns the event type for UserGuildSettingsUpdate events.
  613. func (eh userGuildSettingsUpdateEventHandler) Type() string {
  614. return userGuildSettingsUpdateEventType
  615. }
  616. // New returns a new instance of UserGuildSettingsUpdate.
  617. func (eh userGuildSettingsUpdateEventHandler) New() interface{} {
  618. return &UserGuildSettingsUpdate{}
  619. }
  620. // Handle is the handler for UserGuildSettingsUpdate events.
  621. func (eh userGuildSettingsUpdateEventHandler) Handle(s *Session, i interface{}) {
  622. if t, ok := i.(*UserGuildSettingsUpdate); ok {
  623. eh(s, t)
  624. }
  625. }
  626. // userSettingsUpdateEventHandler is an event handler for UserSettingsUpdate events.
  627. type userSettingsUpdateEventHandler func(*Session, *UserSettingsUpdate)
  628. // Type returns the event type for UserSettingsUpdate events.
  629. func (eh userSettingsUpdateEventHandler) Type() string {
  630. return userSettingsUpdateEventType
  631. }
  632. // New returns a new instance of UserSettingsUpdate.
  633. func (eh userSettingsUpdateEventHandler) New() interface{} {
  634. return &UserSettingsUpdate{}
  635. }
  636. // Handle is the handler for UserSettingsUpdate events.
  637. func (eh userSettingsUpdateEventHandler) Handle(s *Session, i interface{}) {
  638. if t, ok := i.(*UserSettingsUpdate); ok {
  639. eh(s, t)
  640. }
  641. }
  642. // userUpdateEventHandler is an event handler for UserUpdate events.
  643. type userUpdateEventHandler func(*Session, *UserUpdate)
  644. // Type returns the event type for UserUpdate events.
  645. func (eh userUpdateEventHandler) Type() string {
  646. return userUpdateEventType
  647. }
  648. // New returns a new instance of UserUpdate.
  649. func (eh userUpdateEventHandler) New() interface{} {
  650. return &UserUpdate{}
  651. }
  652. // Handle is the handler for UserUpdate events.
  653. func (eh userUpdateEventHandler) Handle(s *Session, i interface{}) {
  654. if t, ok := i.(*UserUpdate); ok {
  655. eh(s, t)
  656. }
  657. }
  658. // voiceServerUpdateEventHandler is an event handler for VoiceServerUpdate events.
  659. type voiceServerUpdateEventHandler func(*Session, *VoiceServerUpdate)
  660. // Type returns the event type for VoiceServerUpdate events.
  661. func (eh voiceServerUpdateEventHandler) Type() string {
  662. return voiceServerUpdateEventType
  663. }
  664. // New returns a new instance of VoiceServerUpdate.
  665. func (eh voiceServerUpdateEventHandler) New() interface{} {
  666. return &VoiceServerUpdate{}
  667. }
  668. // Handle is the handler for VoiceServerUpdate events.
  669. func (eh voiceServerUpdateEventHandler) Handle(s *Session, i interface{}) {
  670. if t, ok := i.(*VoiceServerUpdate); ok {
  671. eh(s, t)
  672. }
  673. }
  674. // voiceStateUpdateEventHandler is an event handler for VoiceStateUpdate events.
  675. type voiceStateUpdateEventHandler func(*Session, *VoiceStateUpdate)
  676. // Type returns the event type for VoiceStateUpdate events.
  677. func (eh voiceStateUpdateEventHandler) Type() string {
  678. return voiceStateUpdateEventType
  679. }
  680. // New returns a new instance of VoiceStateUpdate.
  681. func (eh voiceStateUpdateEventHandler) New() interface{} {
  682. return &VoiceStateUpdate{}
  683. }
  684. // Handle is the handler for VoiceStateUpdate events.
  685. func (eh voiceStateUpdateEventHandler) Handle(s *Session, i interface{}) {
  686. if t, ok := i.(*VoiceStateUpdate); ok {
  687. eh(s, t)
  688. }
  689. }
  690. func handlerForInterface(handler interface{}) EventHandler {
  691. switch v := handler.(type) {
  692. case func(*Session, interface{}):
  693. return interfaceEventHandler(v)
  694. case func(*Session, *ChannelCreate):
  695. return channelCreateEventHandler(v)
  696. case func(*Session, *ChannelDelete):
  697. return channelDeleteEventHandler(v)
  698. case func(*Session, *ChannelPinsUpdate):
  699. return channelPinsUpdateEventHandler(v)
  700. case func(*Session, *ChannelUpdate):
  701. return channelUpdateEventHandler(v)
  702. case func(*Session, *Connect):
  703. return connectEventHandler(v)
  704. case func(*Session, *Disconnect):
  705. return disconnectEventHandler(v)
  706. case func(*Session, *Event):
  707. return eventEventHandler(v)
  708. case func(*Session, *GuildBanAdd):
  709. return guildBanAddEventHandler(v)
  710. case func(*Session, *GuildBanRemove):
  711. return guildBanRemoveEventHandler(v)
  712. case func(*Session, *GuildCreate):
  713. return guildCreateEventHandler(v)
  714. case func(*Session, *GuildDelete):
  715. return guildDeleteEventHandler(v)
  716. case func(*Session, *GuildEmojisUpdate):
  717. return guildEmojisUpdateEventHandler(v)
  718. case func(*Session, *GuildIntegrationsUpdate):
  719. return guildIntegrationsUpdateEventHandler(v)
  720. case func(*Session, *GuildMemberAdd):
  721. return guildMemberAddEventHandler(v)
  722. case func(*Session, *GuildMemberRemove):
  723. return guildMemberRemoveEventHandler(v)
  724. case func(*Session, *GuildMemberUpdate):
  725. return guildMemberUpdateEventHandler(v)
  726. case func(*Session, *GuildMembersChunk):
  727. return guildMembersChunkEventHandler(v)
  728. case func(*Session, *GuildRoleCreate):
  729. return guildRoleCreateEventHandler(v)
  730. case func(*Session, *GuildRoleDelete):
  731. return guildRoleDeleteEventHandler(v)
  732. case func(*Session, *GuildRoleUpdate):
  733. return guildRoleUpdateEventHandler(v)
  734. case func(*Session, *GuildUpdate):
  735. return guildUpdateEventHandler(v)
  736. case func(*Session, *MessageAck):
  737. return messageAckEventHandler(v)
  738. case func(*Session, *MessageCreate):
  739. return messageCreateEventHandler(v)
  740. case func(*Session, *MessageDelete):
  741. return messageDeleteEventHandler(v)
  742. case func(*Session, *MessageDeleteBulk):
  743. return messageDeleteBulkEventHandler(v)
  744. case func(*Session, *MessageReactionAdd):
  745. return messageReactionAddEventHandler(v)
  746. case func(*Session, *MessageReactionRemove):
  747. return messageReactionRemoveEventHandler(v)
  748. case func(*Session, *MessageUpdate):
  749. return messageUpdateEventHandler(v)
  750. case func(*Session, *PresenceUpdate):
  751. return presenceUpdateEventHandler(v)
  752. case func(*Session, *PresencesReplace):
  753. return presencesReplaceEventHandler(v)
  754. case func(*Session, *RateLimit):
  755. return rateLimitEventHandler(v)
  756. case func(*Session, *Ready):
  757. return readyEventHandler(v)
  758. case func(*Session, *RelationshipAdd):
  759. return relationshipAddEventHandler(v)
  760. case func(*Session, *RelationshipRemove):
  761. return relationshipRemoveEventHandler(v)
  762. case func(*Session, *Resumed):
  763. return resumedEventHandler(v)
  764. case func(*Session, *TypingStart):
  765. return typingStartEventHandler(v)
  766. case func(*Session, *UserGuildSettingsUpdate):
  767. return userGuildSettingsUpdateEventHandler(v)
  768. case func(*Session, *UserSettingsUpdate):
  769. return userSettingsUpdateEventHandler(v)
  770. case func(*Session, *UserUpdate):
  771. return userUpdateEventHandler(v)
  772. case func(*Session, *VoiceServerUpdate):
  773. return voiceServerUpdateEventHandler(v)
  774. case func(*Session, *VoiceStateUpdate):
  775. return voiceStateUpdateEventHandler(v)
  776. }
  777. return nil
  778. }
  779. func init() {
  780. registerInterfaceProvider(channelCreateEventHandler(nil))
  781. registerInterfaceProvider(channelDeleteEventHandler(nil))
  782. registerInterfaceProvider(channelPinsUpdateEventHandler(nil))
  783. registerInterfaceProvider(channelUpdateEventHandler(nil))
  784. registerInterfaceProvider(guildBanAddEventHandler(nil))
  785. registerInterfaceProvider(guildBanRemoveEventHandler(nil))
  786. registerInterfaceProvider(guildCreateEventHandler(nil))
  787. registerInterfaceProvider(guildDeleteEventHandler(nil))
  788. registerInterfaceProvider(guildEmojisUpdateEventHandler(nil))
  789. registerInterfaceProvider(guildIntegrationsUpdateEventHandler(nil))
  790. registerInterfaceProvider(guildMemberAddEventHandler(nil))
  791. registerInterfaceProvider(guildMemberRemoveEventHandler(nil))
  792. registerInterfaceProvider(guildMemberUpdateEventHandler(nil))
  793. registerInterfaceProvider(guildMembersChunkEventHandler(nil))
  794. registerInterfaceProvider(guildRoleCreateEventHandler(nil))
  795. registerInterfaceProvider(guildRoleDeleteEventHandler(nil))
  796. registerInterfaceProvider(guildRoleUpdateEventHandler(nil))
  797. registerInterfaceProvider(guildUpdateEventHandler(nil))
  798. registerInterfaceProvider(messageAckEventHandler(nil))
  799. registerInterfaceProvider(messageCreateEventHandler(nil))
  800. registerInterfaceProvider(messageDeleteEventHandler(nil))
  801. registerInterfaceProvider(messageDeleteBulkEventHandler(nil))
  802. registerInterfaceProvider(messageReactionAddEventHandler(nil))
  803. registerInterfaceProvider(messageReactionRemoveEventHandler(nil))
  804. registerInterfaceProvider(messageUpdateEventHandler(nil))
  805. registerInterfaceProvider(presenceUpdateEventHandler(nil))
  806. registerInterfaceProvider(presencesReplaceEventHandler(nil))
  807. registerInterfaceProvider(readyEventHandler(nil))
  808. registerInterfaceProvider(relationshipAddEventHandler(nil))
  809. registerInterfaceProvider(relationshipRemoveEventHandler(nil))
  810. registerInterfaceProvider(resumedEventHandler(nil))
  811. registerInterfaceProvider(typingStartEventHandler(nil))
  812. registerInterfaceProvider(userGuildSettingsUpdateEventHandler(nil))
  813. registerInterfaceProvider(userSettingsUpdateEventHandler(nil))
  814. registerInterfaceProvider(userUpdateEventHandler(nil))
  815. registerInterfaceProvider(voiceServerUpdateEventHandler(nil))
  816. registerInterfaceProvider(voiceStateUpdateEventHandler(nil))
  817. }