1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-12-11 16:05:00 +00:00
arikawa/utils/cmd/genevent/template.tmpl

28 lines
705 B
Cheetah
Raw Normal View History

// Code generated by genevent. DO NOT EDIT.
package {{ .PackageName }}
import "github.com/diamondburned/arikawa/v3/utils/ws"
func init() {
OpUnmarshalers.Add(
{{ range .EventTypes -}}
func() ws.Event { return new({{ .StructName }}) },
{{ end -}}
)
}
{{ range .EventTypes }}
{{ if .IsDispatch }}
// Op implements Event. It always returns 0.
func (*{{ .StructName }}) Op() ws.OpCode { return dispatchOp }
{{ else if (gt .OpCode -1) }}
// Op implements Event. It always returns Op {{ .OpCode }}.
func (*{{ .StructName }}) Op() ws.OpCode { return {{ .OpCode }} }
{{ end }}
// EventType implements Event.
func (*{{ .StructName }}) EventType() ws.EventType { return "{{ .EventName }}" }
{{ end }}