Skip to content

feat: reply with usage instead of raising on command syntax errors - #46

Merged
missytake merged 1 commit into
mainfrom
j4n/command-syntax-errors
Aug 13, 2026
Merged

missytake merged 1 commit into
mainfrom
j4n/command-syntax-errors

Conversation

@j4n

@j4n j4n commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Exceptions from malformed commands (e.g. /set_name with no name) used to propagate to the crew-wide exception notifier, paging the crew for what's really just a user typo. Add targeted handling so the sender gets an inline usage reply instead, while unrelated bugs still reach the crew.

Rewrote command dispatch in relay.py from chained if checks to match/case. Most commands can now catch argument errors by shape, new_message gets a try/except check.
Generally preserved behavior, with the exception of "/set_name " or "/set_outside_help " (trailing whitespace) that allowed to silently set an empty name/help text.

tests/test_bot.py: add test_command_syntax_errors covering /set_name, /new_message, and /add_contact syntax errors, and confirm the bot keeps handling messages normally afterward.

Exceptions from malformed commands (e.g. /set_name with no name) used to
propagate to the crew-wide exception notifier, paging the crew for what's
really just a user typo. Add targeted handling so the sender gets an
inline usage reply instead, while unrelated bugs still reach the crew.

Rewrote command dispatch in relay.py from chained if checks to match/case.
Most commands can now catch argument errors by shape, new_message gets a
try/except check.
Generally preserved behavior, with the exception of "/set_name " or
"/set_outside_help " (trailing whitespace) that allowed to silently set
an empty name/help text.

tests/test_bot.py: add test_command_syntax_errors covering /set_name,
/new_message, and /add_contact syntax errors, and confirm the bot keeps
handling messages normally afterward.
@j4n
j4n requested a review from missytake July 29, 2026 18:46

@missytake missytake left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it! Thanks :)))

@missytake
missytake merged commit 132c6fa into main Aug 13, 2026
3 checks passed
@missytake
missytake deleted the j4n/command-syntax-errors branch August 13, 2026 12:07
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.

2 participants