Skip to content

Clarify bot code with KISS / clean-code pass - #13

Merged
jackharrhy merged 1 commit into
mainfrom
cursor/code-quality-kiss-6d2a
Nov 5, 2026
Merged

jackharrhy merged 1 commit into
mainfrom
cursor/code-quality-kiss-6d2a

Conversation

@SteveParson

Copy link
Copy Markdown
Owner

Summary

Small, readability-first cleanup guided by KISS / clean-code habits. Same behavior; no new modules or parser rewrite.

Changes

  • king.c: named Discord opcodes & intents; extract normalize_token, heartbeat_with_retry, handle_gateway_payload; early returns in message/REST helpers
  • json.c: shared parse_int_value / value_in_object (DRY nested getters)
  • log.h: one log_write behind log_error / log_info / log_debug
  • net: drop unused tls_conn.ca, remove noop entropy wrapper, fix misleading “opaque” comment
  • ws.c: named opcodes; drain_payload for oversized frames

Intentionally skipped

  • No layering / DI / general JSON parser — would hurt how easy this tiny repo is to read
  • No behavior or Discord protocol changes

Verification

make docker-test   # 84 passed
make docker-lint   # clean
Open in Web Open in Cursor 

Name Discord/WebSocket opcodes, DRY JSON int parsing and logging,
extract heartbeat/token/dispatch helpers, and drop dead TLS state —
keeping the small module layout and readability.

Co-authored-by: me <me@steveparson.ca>
@jackharrhy
jackharrhy merged commit 7e9c5d0 into main Nov 5, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants