feat: add stats subcommand to existing .github command#1729
Open
oskarnurm wants to merge 12 commits intopython-discord:mainfrom
Open
feat: add stats subcommand to existing .github command#1729oskarnurm wants to merge 12 commits intopython-discord:mainfrom
stats subcommand to existing .github command#1729oskarnurm wants to merge 12 commits intopython-discord:mainfrom
Conversation
* feat: rename file to follow project convention * feat: add issue count method * feat: return -1 if fetching issues failed
* feat: implemented get_commit_count metohd * fix: fixed status code handling * fix: fixed the potential excessive API calls by reading the links header --------- Co-authored-by: Markus Selin <marselin@kth.sem>
* feat: add get_stars_gained * refactor: optimize github API requests --------- Co-authored-by: Ali Najib <anajib@kth.se> Co-authored-by: Oskar Nurm <19738295+oskarnurm@users.noreply.github.com>
* feat: implemented validate methods * fix: fixed validate methods to match the functionality of the command * fix: removed the async since it isnt needed
* feat: implemented the validate methods into githubinfo.py * feat: check date before API calls and simplify validate range Checking valid input before API calls is smarter as we can prevent someone rate limiting the bot this way. We also don't need to guard against future calls as GitHub will just happily return all the issues up to the present moment. --------- Co-authored-by: oskarnurm <19738295+oskarnurm@users.noreply.github.com>
jb3
requested changes
Mar 1, 2026
Member
jb3
left a comment
There was a problem hiding this comment.
Feedback comments left.
Please also revert the linting changes you've made to the repository, none of the linting tools we use should've raised errors providing you are using the versions we specify in our pyproject.toml and are using uv & ruff is picking up our configuration correctly.
Author
|
Thank you @jb3 for the extensive review. I apologize for the headache with the linting. Turns out I was wrong to trust |
e604f35 to
b2ed216
Compare
* fix: raise exceptions for errors instead of integers * fix: use literals when passing arguments * fix: not pass headers around and add a few missing exception raises * chore: update pydis_core * refactor: refine error handling
Author
|
Hey @jb3, I think I have resolved all the issues now. Hopefully didn't miss anything. Key changes:
|
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
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.
Relevant Issues
Closes #1724
Fixes #1728
Description
Added the subcommand
statsto the existing command.github.The
statscommand will take the arguments<start_date> <end_date> <repo>where the date is formattedYY-MM-DDand repo follows theusername/nameformat. The bot will then fetch and display GitHub stats for the given repo over the specified timeframe.Example:

Key changes:
This was done by adding several helper methods to
githubinfo.pythat thestatscommand would then call:get_issue_countget_pr_countget_commit_countget_stars_gainedparse_date,validate_date_formatvalidate_date_rangeDid you: