Skip to content

feat: Add activity command #50

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

Merged
merged 2 commits into from
May 6, 2025
Merged

feat: Add activity command #50

merged 2 commits into from
May 6, 2025

Conversation

actionbrk
Copy link
Owner

No description provided.

@DonatienBaille DonatienBaille requested a review from Copilot April 30, 2025 20:19
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a new feature for tracking and visualizing activity trends in a Discord bot by adding an activity command.

  • Added an ActivityResult interface in the database model.
  • Created a new getActivity function in the database layer to retrieve daily message counts.
  • Developed a new command (activity) with interactive trend plotting and menu options, along with textual updates in related commands.

Reviewed Changes

Copilot reviewed 5 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/models/database/activity-result.ts Introduces the ActivityResult interface for database results
src/database/bee-database.ts Implements the getActivity function for querying activity data
src/commands/activity/trend.ts Updates graph footer text for trend command
src/commands/activity/compare.ts Updates graph footer text for compare command
src/commands/activity/activity.ts Adds the new activity command with trend plotting and interactive UI
Files not reviewed (2)
  • src/locales/en-US.json: Language not supported
  • src/locales/fr.json: Language not supported
Comments suppressed due to low confidence (1)

src/commands/activity/activity.ts:187

  • [nitpick] The purpose and expected values of the 'dateMode' parameter in plotTrend are unclear. Consider adding inline documentation or comments to explain how 'dateMode' influences the start date calculation for the trend.
rolling = 14, dateMode = 0

Comment on lines +216 to +223
let locale = (await import("date-fns/locale/" + userLocale))[userLocale.replace("-", "")];
if (!locale) {
Copy link
Preview

Copilot AI Apr 30, 2025

Choose a reason for hiding this comment

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

[nitpick] The dynamic import of the locale module assumes the requested locale always exists. It might be beneficial to add error handling or a fallback mechanism beyond simply defaulting to enUS to enhance robustness.

Suggested change
let locale = (await import("date-fns/locale/" + userLocale))[userLocale.replace("-", "")];
if (!locale) {
let locale;
try {
const importedLocale = await import("date-fns/locale/" + userLocale);
locale = importedLocale[userLocale.replace("-", "")];
} catch (error) {
logger.error(`Failed to load locale for userLocale "${userLocale}":`, error);

Copilot uses AI. Check for mistakes.

@actionbrk actionbrk force-pushed the activity-command branch from ea7e33d to 0212f60 Compare May 6, 2025 23:39
@actionbrk actionbrk merged commit 11bb454 into master May 6, 2025
3 checks passed
@actionbrk actionbrk deleted the activity-command branch May 6, 2025 23:43
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.

2 participants