Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor command handler and error handling #24

Merged
merged 1 commit into from
Oct 27, 2024

Conversation

outmaneuver
Copy link
Owner

Move command handler to utils and add error handling decorator.

  • Command Handler:

    • Add utils/command_handler.py to handle commands.
    • Move command handler logic from selfbot.py to utils/command_handler.py.
    • Define CommandHandler class to handle commands and interactions.
  • Error Handling:

    • Add utils/error_handler.py to handle errors.
    • Define error_handler decorator to handle errors.
    • Refactor existing error handling logic into the decorator.
  • SelfBot:

    • Remove command handler logic and import from utils/command_handler.py.
    • Remove error handling logic and import from utils/error_handler.py.
    • Update SelfBot class to use CommandHandler and error_handler.
  • Cogs:

    • Remove try-except blocks and use error_handler decorator in cogs/custom_activity_cog.py, cogs/help_cog.py, cogs/moderation_cog.py, cogs/name_history_cog.py, and cogs/avatar_history_cog.py.
    • Import error_handler from utils/error_handler.py in each cog file.
    • Apply error_handler decorator to command methods in each cog file.

Move command handler to `utils` and add error handling decorator.

* **Command Handler:**
  - Add `utils/command_handler.py` to handle commands.
  - Move command handler logic from `selfbot.py` to `utils/command_handler.py`.
  - Define `CommandHandler` class to handle commands and interactions.

* **Error Handling:**
  - Add `utils/error_handler.py` to handle errors.
  - Define `error_handler` decorator to handle errors.
  - Refactor existing error handling logic into the decorator.

* **SelfBot:**
  - Remove command handler logic and import from `utils/command_handler.py`.
  - Remove error handling logic and import from `utils/error_handler.py`.
  - Update `SelfBot` class to use `CommandHandler` and `error_handler`.

* **Cogs:**
  - Remove `try-except` blocks and use `error_handler` decorator in `cogs/custom_activity_cog.py`, `cogs/help_cog.py`, `cogs/moderation_cog.py`, `cogs/name_history_cog.py`, and `cogs/avatar_history_cog.py`.
  - Import `error_handler` from `utils/error_handler.py` in each cog file.
  - Apply `error_handler` decorator to command methods in each cog file.
@outmaneuver outmaneuver merged commit 03c761a into main Oct 27, 2024
1 of 2 checks passed
@outmaneuver outmaneuver deleted the refactor-command-handler branch October 27, 2024 02:17
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