eventhandlers.go 35 KB

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