eventhandlers.go 33 KB

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