Skip to content

Feat/error handler#5

Merged
trynogaunt merged 2 commits intomainfrom
feat/error_handler
Feb 5, 2026
Merged

Feat/error handler#5
trynogaunt merged 2 commits intomainfrom
feat/error_handler

Conversation

@trynogaunt
Copy link
Copy Markdown
Owner

This pull request makes several improvements to the Discord bot's core application, focusing on better error handling for application commands and improved logging, especially for deployment environments like Railway. The most significant changes are the addition of a custom error handler for application commands, redirection of standard error to standard output for logging consistency, and minor adjustments to the bot run configuration.

Error handling improvements:

  • Added a custom on_tree_error method to the BotApp class to handle common app_commands errors (such as cooldowns, missing permissions, and check failures) with user-friendly, localized messages and appropriate logging.

Logging improvements:

  • Redirected sys.stderr to sys.stdout and updated the stream handler to use sys.stdout to address Railway logging issues and ensure all logs are captured consistently.
  • Imported sys to support the above logging changes.

Bot startup configuration:

  • Changed the bot.run call to disable the default Discord log handler by passing log_handler=None, preventing duplicate logs.

@trynogaunt trynogaunt merged commit a894037 into main Feb 5, 2026
1 check 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.

1 participant