refactor: rename MessageType to IRCMessageType with full API
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:
user
2026-03-10 10:31:22 -07:00
parent 164fec3fc8
commit ba2c113a85
3 changed files with 198 additions and 162 deletions

View File

@@ -398,12 +398,12 @@ func (hdlr *Handlers) serverName() string {
func (hdlr *Handlers) enqueueNumeric(
ctx context.Context,
clientID int64,
code irc.MessageType,
code irc.IRCMessageType,
nick string,
params []string,
text string,
) {
command := code.String()
command := code.Code()
body, err := json.Marshal([]string{text})
if err != nil {
@@ -969,7 +969,7 @@ func (hdlr *Handlers) respondIRCError(
writer http.ResponseWriter,
request *http.Request,
clientID, sessionID int64,
code irc.MessageType,
code irc.IRCMessageType,
nick string,
params []string,
text string,