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

Beta #164

Merged
merged 7 commits into from
Jan 20, 2025
Merged

Beta #164

merged 7 commits into from
Jan 20, 2025

Conversation

5hojib
Copy link
Collaborator

@5hojib 5hojib commented Jan 20, 2025

Summary by Sourcery

Enhancements:

  • Remove the "refresh status" and "overview status" buttons, simplifying the status interface.

5hojib and others added 6 commits January 19, 2025 19:51
## Summary by Sourcery

Bug Fixes:

- Fixed token generation issues caused by the command suffix.

Co-authored-by: Mirror Hunter <dpmirror@proton.me>
Copy link
Contributor

sourcery-ai bot commented Jan 20, 2025

Reviewer's Guide by Sourcery

This pull request refactors the status command, removing the overview page and associated logic. It also updates the default branch to 'beta' and fixes a bug in the shortener logic.

Sequence diagram for simplified status command flow

Loading
sequenceDiagram
    participant User
    participant Bot
    participant TaskDict

    User->>Bot: Send status query
    Bot->>TaskDict: Get task data
    alt Next/Previous page
        Bot->>Bot: Update page number
    else Status change
        Bot->>TaskDict: Update task status
    end
    Bot->>User: Return status message with navigation buttons

Class diagram for bot commands update

Loading
classDiagram
    class BotCommands {
        +StartCommand: str
        +MirrorCommand: list
        +YtdlCommand: list
        +LeechCommand: list
    }
    note for BotCommands "StartCommand simplified to 'start'"

State diagram for URL shortener logic

Loading
stateDiagram-v2
    [*] --> CheckShorteners
    CheckShorteners --> ReturnOriginal: No shorteners available
    CheckShorteners --> AttemptShorten: Shorteners available
    AttemptShorten --> ReturnShortened: Success
    AttemptShorten --> RetryAttempt: Failure
    RetryAttempt --> AttemptShorten: Retry < 4
    RetryAttempt --> ReturnOriginal: Retry >= 4
    ReturnShortened --> [*]
    ReturnOriginal --> [*]

File-Level Changes

Change Details Files
Removed the overview page from the status command.
  • Removed the 'ov' case from the status_pages function.
  • Removed the logic for displaying the overview page.
  • Removed the button for the overview page.
bot/modules/status.py
Updated the status message to remove the overview button.
  • Removed the overview button from the status message.
  • Added a check to avoid creating a button maker if there are no buttons to add.
bot/helper/ext_utils/status_utils.py
Fixed a bug in the shortener logic.
  • Added a check to return the original URL if the shorteners list is empty.
bot/helper/aeon_utils/shorteners.py
Updated the default branch to 'beta'.
  • Changed the default value of UPSTREAM_BRANCH to 'beta'.
update.py
Removed the index from the start command.
  • Changed the StartCommand to 'start'.
bot/helper/telegram_helper/bot_commands.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @5hojib - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Please provide documentation explaining the rationale behind removing the status overview feature ('ov' command). This seems like a significant reduction in monitoring capabilities that should be justified.
  • The PR title and description are too vague. Please add a proper description explaining the purpose and impact of these changes.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@@ -257,8 +256,7 @@ async def get_readable_message(sid, is_user, page_no=1, status="All", page_step=
for label, status_value in list(STATUSES.items()):
if status_value != status:
buttons.data_button(label, f"status {sid} st {status_value}")
buttons.data_button("♻️", f"status {sid} ref", position="header")
button = buttons.build_menu(8)
button = buttons.build_menu(8) if buttons else None
msg += f"<b>CPU:</b> {cpu_percent()}% | <b>FREE:</b> {get_readable_file_size(disk_usage(Config.DOWNLOAD_DIR).free)}"
Copy link
Contributor

Choose a reason for hiding this comment

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

issue (bug_risk): This line creates a refresh button that won't work since its handler was removed from status.py

The refresh button handler (data[2] == "ref" case) was removed from status.py, but this code still tries to create the refresh button. This will lead to a non-functional UI element.

@5hojib 5hojib merged commit 1b8d3a7 into main Jan 20, 2025
1 check passed
@5hojib 5hojib deleted the beta branch January 20, 2025 08:26
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.

None yet

1 participant