fix: remove dead code, fold migration 002 into 001, implement error numerics
All checks were successful
check / check (push) Successful in 2m22s

- Remove unused GetAwayByNick() from queries.go
- Delete migration 002; fold away_message and topic_set_by/topic_set_at
  columns into migration 001 (pre-1.0 policy: single migration file)
- PRIVMSG/NOTICE missing target now sends 411 ERR_NORECIPIENT
- PRIVMSG/NOTICE missing body now sends 412 ERR_NOTEXTTOSEND
- Non-member channel send now sends 404 ERR_CANNOTSENDTOCHAN
- Auth failure now returns 451 ERR_NOTREGISTERED numeric in response
- Update test assertions to match correct IRC numerics
This commit is contained in:
clawbot
2026-03-10 10:33:20 -07:00
parent 5753c1a1a1
commit 3dc783c206
5 changed files with 19 additions and 42 deletions

View File

@@ -1146,25 +1146,6 @@ func (database *Database) GetAway(
return msg, nil
}
// GetAwayByNick returns the away message for a nick.
// Returns an empty string if the user is not away.
func (database *Database) GetAwayByNick(
ctx context.Context,
nick string,
) (string, error) {
var msg string
err := database.conn.QueryRowContext(ctx,
"SELECT away_message FROM sessions WHERE nick = ?",
nick,
).Scan(&msg)
if err != nil {
return "", fmt.Errorf("get away by nick: %w", err)
}
return msg, nil
}
// SetTopicMeta sets the topic along with who set it and
// when.
func (database *Database) SetTopicMeta(