discordgo
discordgo copied to clipboard
Use enum replace magic number in Event opeation
I was confused when I debug here, I didn't understand what the different operations meant until I notice the comments. Maybe define enum for every operation and replace magic number can make it easy to understand. e.g.
// use iota if operation number is progressive
const (
_ = iota
xxxOperation
)
// or
const (
PingOperation = 1
ReconnectOperation = 7
InvalidSessionOperation = 9
HeartbeatOperation = 11
)
...
switch e.Operation {
case PingOperation:
//...
case ReconnectOperation:
//...
default:
//...
}