Skip to content

Feat/help thread stats#1361

Open
ankitsmt211 wants to merge 16 commits intoTogether-Java:developfrom
ankitsmt211:feat/help-thread-stats
Open

Feat/help thread stats#1361
ankitsmt211 wants to merge 16 commits intoTogether-Java:developfrom
ankitsmt211:feat/help-thread-stats

Conversation

@ankitsmt211
Copy link
Member

@ankitsmt211 ankitsmt211 commented Dec 21, 2025

continues work of #1159 with /help-stats slash command, refactors to fetch stats from database instead of discord APIs. Also adds stats to embed for better UX.

image

embed color has three states

  • GREEN (high response rates)
  • ORANGE (medium response rates)
  • RED(low response rates)

edited: also adds per channel limit, can be used once per minute.

vishv843 and others added 3 commits August 29, 2024 15:29
replaces fetching metrics directly from database instead
of discord, uses embed for showcases stats and making
duration as optional choice in terms of days
@ankitsmt211 ankitsmt211 self-assigned this Dec 21, 2025
@ankitsmt211 ankitsmt211 requested a review from a team as a code owner December 21, 2025 10:59
spotless fixes, helper for calculating duration in seconds
between datetime fields to be more compliant with code quality tests
change emojis to unicode character constants with descriptive names,
single/blank line of space to be more intentional and clear
Copy link
Contributor

@tj-wazei tj-wazei left a comment

Choose a reason for hiding this comment

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

I think this is fine, just some small changes to the imports.

Copy link
Member

@SquidXTV SquidXTV left a comment

Choose a reason for hiding this comment

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

Good job!

I kinda abused some review comments for future ideas and questions.

ankitsmt211 and others added 2 commits January 5, 2026 22:02
…/HelpThreadStatsCommand.java


use a more simpler way to get days and a fallback if user entered option is missing

Co-authored-by: Connor Schweighöfer <squidxtv@gmail.com>
since when saving thread meta data, participant count
excludes author which means thread with 0 participants should
be counted as ghost threads instead of single participant
to avoid users from spamming, this adds
a cooldown period of a min per channel
uses Duration instance for expiration of cache items instead
of seperate values for ease of maintenance and clarity
SquidXTV
SquidXTV previously approved these changes Jan 5, 2026
utf code with actual emojis for clarity,
break onSlash handler into more helpers
update helpthreadlistener to only store
true participant count in database
Comment on lines +106 to +107
int messageCount = threadChannel.getMessageCount(); // TODO: to be replaced with participant
// message count
Copy link
Member

Choose a reason for hiding this comment

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

dangling todo. will this be done in this PR or in another? consider maybe making a gh issue if latter

Comment on lines +199 to +200
long secondsSinceLastUsage = getSecondsSinceLastUsage(channelId, now);
if (secondsSinceLastUsage != 0L) {
Copy link
Member

Choose a reason for hiding this comment

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

i dont quite get this. feels to me like ur abusing 0 as magic value to indicate something.

like, lets say i used the command 2 days ago, then a method named getSecondsSinceLastUsage should return me the seconds equivalent for 2 days and not 0.

consider renaming this to maybe getSecondsStillOnCooldown or something similar

Comment on lines +244 to +247
double helpThreadInteractionRate = totalHelpThreadsCreated > 0
? ((double) (totalHelpThreadsCreated - ghostThreads) / totalHelpThreadsCreated)
* 100
: -1;
Copy link
Member

Choose a reason for hiding this comment

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

whats this? definitely needs a good name (or helper method) so this "formula" is easy to understand at first glance.

Comment on lines 138 to 135
.where(HELP_THREADS.CREATED_AT.ge(startDate))
.where(HELP_THREADS.CREATED_AT.ge(statsDurationStartDate))
.fetchOne();

if (statsRecord == null || statsRecord.get(TOTAL_CREATED_FIELD, Integer.class) == 0) {
event.getHook()
.editOriginal("No stats available for the last " + days + " days.")
.queue();
return null;
return Optional.empty();
Copy link
Member

Choose a reason for hiding this comment

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

im pretty sure there is some variant of that fetchOne() that also returns an Optional already. in which case the code below could be simplified by using the optional-api instead

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.

5 participants