refactor: add irc.MessageType custom type with Name() and String() methods
All checks were successful
check / check (push) Successful in 2m28s

- Create 'type MessageType int' in pkg/irc/numerics.go
- Type all Rpl*/Err* numeric constants as MessageType
- Add Name() method returning the standard IRC name (e.g. RPL_WELCOME)
- Add String() method returning zero-padded numeric (e.g. 001)
- Update enqueueNumeric/respondIRCError to accept MessageType
- Update internal/db to use MessageType conversion for Name() calls
- Change names map key type from int to MessageType

Refs #52
This commit is contained in:
clawbot
2026-03-10 10:17:57 -07:00
parent fa347772f2
commit 164fec3fc8
3 changed files with 171 additions and 153 deletions

View File

@@ -746,7 +746,7 @@ func scanMessages(
code, _ := strconv.Atoi(msg.Command)
msg.Code = code
if name := irc.Name(code); name != "" {
if name := irc.Name(irc.MessageType(code)); name != "" {
msg.Command = name
}
}