Skip to content

Conversation

@daniithethomp
Copy link
Contributor

@daniithethomp daniithethomp commented Dec 21, 2025

Thanks for contributing to this repository!

What is the pull request for?

Adds a function to see guild-specific message statistics

embed for leaderboard:
image

embed for user stats:
image

Command: /message stats <optional: user> <optional: limit (default = 10)>

  • user – the user to see message stats for (if not provided, defaults to a leaderboard)
  • limit – the maximum number of users to display on the leaderboard (ignored if user stats)

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_SINCE constant in cogs/message.py should 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:

  • Pagination for guilds with over 25 users
  • Separate leaderboard and user stats
  • Remove deletion of guild data when tracking disabled
  • Remove deletion of user data when tracking disabled
  • Add command for removal of data for guilds/users
  • Modify message tracking data to track:
    • channel ids
    • timestamps
    • content length?
    • word count?
    • mentions
    • reactions
    • attachments
    • emojis

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 only

Please check the boxes if appropriate

  • I have tested these changes
  • This PR fixes an open issue
  • This PR adds a new feature

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

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