Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Session.AddHandler types #1445

Open
Malix-off opened this issue Sep 7, 2023 · 0 comments
Open

Session.AddHandler types #1445

Malix-off opened this issue Sep 7, 2023 · 0 comments

Comments

@Malix-off
Copy link

Malix-off commented Sep 7, 2023

About Session.AddHandler

func (s *Session) AddHandler(handler interface{}) func() {

The documentation about its parameter and return types is only in the go doc comments

discordgo/event.go

Lines 101 to 119 in a2079d3

// The first parameter is a *Session, and the second parameter is a pointer
// to a struct corresponding to the event for which you want to listen.
//
// eg:
// Session.AddHandler(func(s *discordgo.Session, m *discordgo.MessageCreate) {
// })
//
// or:
// Session.AddHandler(func(s *discordgo.Session, m *discordgo.PresenceUpdate) {
// })
//
// List of events can be found at this page, with corresponding names in the
// library for each event: https://discord.com/developers/docs/topics/gateway#event-names
// There are also synthetic events fired by the library internally which are
// available for handling, like Connect, Disconnect, and RateLimit.
// events.go contains all of the Discord WSAPI and synthetic events that can be handled.
//
// The return value of this method is a function, that when called will remove the
// event handler.

Thus, resulting in bad documentation references and no type safety

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant