refactor: rename MessageType to IRCMessageType with full API
All checks were successful
check / check (push) Successful in 4s
All checks were successful
check / check (push) Successful in 4s
- Rename MessageType to IRCMessageType (custom int type) - .Name() returns just the name (e.g. "RPL_LUSEROP") - .String() returns name + code (e.g. "RPL_LUSEROP <252>") - .Code() returns zero-padded 3-digit string (e.g. "252") - .Int() returns the bare int value - Add FromInt() package-level function with validation - Update all call sites to use new type and methods
This commit is contained in:
@@ -746,8 +746,8 @@ func scanMessages(
|
||||
code, _ := strconv.Atoi(msg.Command)
|
||||
msg.Code = code
|
||||
|
||||
if name := irc.Name(irc.MessageType(code)); name != "" {
|
||||
msg.Command = name
|
||||
if mt, err := irc.FromInt(code); err == nil {
|
||||
msg.Command = mt.Name()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user