-
- Notifications
You must be signed in to change notification settings - Fork 41
feat: update moderation, tools, and utility cogs #960
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
Draft
kzndotsh wants to merge 1 commit into main Choose a base branch from 04-other-cogs-split
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
+74 −121
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
- Improve tempban functionality - Update wolfram integration - Enhance AFK and reminder utilities
Contributor
Reviewer's GuideThis PR refactors core utility and moderation cogs by replacing manual scheduling with a dedicated service, strengthening background task loops with better locking, logging, and error handling, and streamlining configuration-driven loading for the Wolfram cog. Sequence diagram for RemindMe command scheduling with ReminderServicesequenceDiagram actor User participant Bot participant RemindMe participant ReminderService User->>Bot: $remindme 1h30m take a break Bot->>RemindMe: remindme(ctx, time, reminder) RemindMe->>ReminderService: schedule_reminder(reminder_obj) ReminderService-->>RemindMe: (reminder scheduled) RemindMe-->>Bot: reply with confirmation Bot-->>User: confirmation message Sequence diagram for improved TempBan expiration processingsequenceDiagram participant TempBan participant DB participant Logger participant Sentry loop every 1 minute TempBan->>TempBan: check_tempbans() TempBan->>DB: get_expired_tempbans() alt expired cases found TempBan->>TempBan: _process_tempban_case(case) TempBan->>Logger: log processed/failed else no expired cases TempBan->>Logger: log skip end alt error occurs TempBan->>Logger: log error TempBan->>Sentry: capture_exception(error) end end Sequence diagram for AFK expiration handler with error reportingsequenceDiagram participant AFK participant DB participant Logger participant Sentry loop every 120 seconds AFK->>AFK: handle_afk_expiration() AFK->>DB: get expired AFK entries alt expired entries found AFK->>DB: remove AFK entry end alt error occurs AFK->>Logger: log error AFK->>Sentry: capture_exception(error) end end Class diagram for updated TempBan moderation cogclassDiagram class TempBan { - _processing_tempbans: bool + __init__(bot: Tux) + check_tempbans() // renamed and improved loop + before_check_tempbans() + on_tempban_error(error) + cog_unload() } class ModerationCogBase TempBan --|> ModerationCogBase Class diagram for updated AFK utility cogclassDiagram class AFK { + __init__(bot: Tux) + cog_unload() + handle_afk_expiration() // renamed and improved loop + before_handle_afk_expiration() + on_handle_afk_expiration_error(error) + _get_expired_afk_entries(guild_id: int) } Class diagram for updated RemindMe utility cogclassDiagram class RemindMe { - _initialized: bool // removed + __init__(bot: Tux) + remindme(ctx, time: str, reminder: str) } class ReminderService { + schedule_reminder(reminder_obj) } RemindMe ..> ReminderService : uses Class diagram for updated Wolfram tool cogclassDiagram class Wolfram { + __init__(bot: Tux) + wolfram(ctx, query: str) } File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Deploying tux with |
| Latest commit: | 9be9ed9 |
| Status: | ✅ Deploy successful! |
| Preview URL: | https://2b8bec7b.tux-afh.pages.dev |
| Branch Preview URL: | https://04-other-cogs-split.tux-afh.pages.dev |
Contributor Author
| Depends on: #957 |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
Description
Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change. If this change fixes any issues please put "Fixes #XX" in the description. Please also ensure to add the appropriate labels to the PR.
Guidelines
My code follows the style guidelines of this project (formatted with Ruff)
I have performed a self-review of my own code
I have commented my code, particularly in hard-to-understand areas
I have made corresponding changes to the documentation if needed
My changes generate no new warnings
I have tested this change
Any dependent changes have been merged and published in downstream modules
I have added all appropriate labels to this PR
I have followed all of these guidelines.
How Has This Been Tested? (if applicable)
Please describe how you tested your code. e.g describe what commands you ran, what arguments, and any config stuff (if applicable)
Screenshots (if applicable)
Please add screenshots to help explain your changes.
Additional Information
Please add any other information that is important to this PR.
Summary by Sourcery
Consolidate task scheduling and error handling across utility and moderation cogs, switch RemindMe to use the centralized ReminderService instead of manual timers, simplify Wolfram cog loading based on configuration, and enhance TempBan and AFK loops with improved logging, error hooks, and clean shutdown.
Enhancements: