summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/bwmarrin/discordgo/tools/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/bwmarrin/discordgo/tools/cmd')
-rw-r--r--vendor/github.com/bwmarrin/discordgo/tools/cmd/eventhandlers/main.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/vendor/github.com/bwmarrin/discordgo/tools/cmd/eventhandlers/main.go b/vendor/github.com/bwmarrin/discordgo/tools/cmd/eventhandlers/main.go
index f3894085..839f009d 100644
--- a/vendor/github.com/bwmarrin/discordgo/tools/cmd/eventhandlers/main.go
+++ b/vendor/github.com/bwmarrin/discordgo/tools/cmd/eventhandlers/main.go
@@ -37,18 +37,18 @@ type {{privateName .}}EventHandler func(*Session, *{{.}})
func (eh {{privateName .}}EventHandler) Type() string {
return {{privateName .}}EventType
}
-
+{{if isDiscordEvent .}}
// New returns a new instance of {{.}}.
func (eh {{privateName .}}EventHandler) New() interface{} {
return &{{.}}{}
-}
-
+}{{end}}
// Handle is the handler for {{.}} events.
func (eh {{privateName .}}EventHandler) Handle(s *Session, i interface{}) {
if t, ok := i.(*{{.}}); ok {
eh(s, t)
}
}
+
{{end}}
func handlerForInterface(handler interface{}) EventHandler {
switch v := handler.(type) {
@@ -60,6 +60,7 @@ func handlerForInterface(handler interface{}) EventHandler {
return nil
}
+
func init() { {{range .}}{{if isDiscordEvent .}}
registerInterfaceProvider({{privateName .}}EventHandler(nil)){{end}}{{end}}
}