Message Stats Command (+ fix for testing cogs with app commands) #647
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.
Thanks for contributing to this repository!
What is the pull request for?
Adds a function to see guild-specific message statistics
embed for leaderboard:

embed for user stats:

Command: /message stats <optional: user> <optional: limit (default = 10)>
The message count is stored as an a dictionary
{guild_id: message_count}in the user doc, and incremented with each new message.These message stats do NOT import historical data as discord rate-limits api calls to 100 messages per call, and it would take weeks to fetch all the data for all users and guilds. If you want to add this that would be sick, but I don't want to get you blocked from discord api lol.
To account for this, a
TRACKING_SINCEconstant incogs/message.pyshould hold the date that the message data has been tracking from (aka when the feature is deployed). This may need rethinking and could be changed to a constant in the DB.TODO:
Other things that could be added to this is the ability to users to opt-out of message counting, and for guilds to choose channels where messages aren't counted.
Also made a minor fix to
testing.py, as the current testing system doesn't automatically fetch cog commands that are app commands onlyPlease check the boxes if appropriate
What issues are fixed by this PR?
If this PR closes any open issues, please add them here
N/A
How can we get in touch with you if we need more info?
Discord: fourshadows4