Skip to content

feat(bot): post server-count stats to Top.gg for listing visibility - #1789

Merged
LucasSantana-Dev merged 6 commits into
mainfrom
feat/1783-topgg-stats
Jul 12, 2026
Merged

LucasSantana-Dev merged 6 commits into
mainfrom
feat/1783-topgg-stats

Conversation

@LucasSantana-Dev

@LucasSantana-Dev LucasSantana-Dev commented Jul 11, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Adds TopGG stats scheduler to periodically post server count to Top.gg API
  • Posts on bot ready + every 30 minutes via existing IntervalScheduler pattern
  • Uses global fetch; no new dependencies

Implementation

  • New: packages/bot/src/utils/general/topggStatsScheduler.ts (scheduler + tests)
  • Uses existing patterns: reuses IntervalScheduler base, wired via ready event
  • Env gate: TOPGG_TOKEN (distinct from TOPGG_AUTH_TOKEN webhook)
  • When unset: logged once at startup, no calls, no errors

Observability

Testing

  • Unit tests: stub fetch, verify POST body/headers, test token gate
  • All 5 tests pass
  • Type check passes

Closes #1783


Summary by cubic

Post the bot’s server count to Top.gg on startup and every 30 minutes to improve listing visibility. Adds a topggStatsScheduler gated by TOPGG_TOKEN, wired into ready/shutdown, uses global fetch with a 10s timeout, and fixes the TOP_GG_BOT_ID import to @lucky/shared/constants. Closes #1783.

  • New Features

    • topggStatsScheduler extends IntervalScheduler; posts server count immediately and on interval; logs success and sends Sentry warnings on failures.
  • Migration

    • Set TOPGG_TOKEN to enable posting (distinct from TOPGG_AUTH_TOKEN); .env.example updated with guidance.

Written for commit ef1f75f. Summary will update on new commits.

Review in cubic

- Add topggStatsScheduler extending IntervalScheduler pattern
- Post server count every 30 min + on bot ready
- Require TOPGG_TOKEN env; skip silently when unset
- Use global fetch; no new dependencies
- Wire into bot ready handler + shutdown sequence
- Observability: Sentry warnings on POST/network failures
- Unit tests: verify token gate, fetch calls, error handling

Closes #1783
@coderabbitai

coderabbitai Bot commented Jul 11, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 18 minutes

Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: bd8b4dce-cbb9-4123-9101-08871cfedcc3

📥 Commits

Reviewing files that changed from the base of the PR and between 772a24b and ef1f75f.

📒 Files selected for processing (5)
  • .env.example
  • packages/bot/src/bot/start/initializer.ts
  • packages/bot/src/handlers/clientHandler/service.ts
  • packages/bot/src/utils/general/topggStatsScheduler.spec.ts
  • packages/bot/src/utils/general/topggStatsScheduler.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/1783-topgg-stats

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added dependencies Pull requests that update a dependency file bot size/xl labels Jul 11, 2026
@socket-security

socket-security Bot commented Jul 11, 2026 •

Copy link
Copy Markdown

No dependency changes detected. Learn more about Socket for GitHub.

👍 No dependency changes detected in pull request

@github-actions

Copy link
Copy Markdown

Failed to generate code suggestions for PR

Comment thread packages/bot/src/utils/general/topggStatsScheduler.spec.ts Fixed

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 6 files

Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Re-trigger cubic

Comment thread packages/bot/src/utils/general/topggStatsScheduler.spec.ts
Comment thread packages/bot/src/utils/general/topggStatsScheduler.ts
Comment thread packages/bot/src/utils/general/topggStatsScheduler.spec.ts
@github-actions github-actions Bot added size/l and removed dependencies Pull requests that update a dependency file size/xl labels Jul 11, 2026
@github-actions

github-actions Bot commented Jul 11, 2026 •

Copy link
Copy Markdown
Fails
🚫

.env files in PR:* .env.example. These should never be committed. If this is .env.example, it still needs explicit confirmation per project policy.

Generated by 🚫 dangerJS against ef1f75f

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

0 issues found across 1 file (changes from recent commits).

Requires human review: Auto-approval blocked by 3 unresolved issues from previous reviews.

Re-trigger cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 2 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread packages/bot/src/utils/general/topggStatsScheduler.spec.ts
@LucasSantana-Dev
LucasSantana-Dev enabled auto-merge (squash) July 12, 2026 01:19

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

0 issues found across 1 file (changes from recent commits).

Requires human review: Adds new external API integration posting server count to Top.gg. Contains production network calls with error handling, env configuration, and integration wiring into startup/shutdown — moderate risk requiring human oversight.

Re-trigger cubic

@sonarqubecloud

Copy link
Copy Markdown

@LucasSantana-Dev
LucasSantana-Dev merged commit e8ca6b9 into main Jul 12, 2026
45 of 46 checks passed
@LucasSantana-Dev
LucasSantana-Dev deleted the feat/1783-topgg-stats branch July 12, 2026 01:26
LucasSantana-Dev added a commit that referenced this pull request Jul 13, 2026
🤖 I have created a release *beep* *boop*
---


<details><summary>2.35.0</summary>

##
[2.35.0](v2.34.0...v2.35.0)
(2026-07-13)


### Features

* **bot:** /bulk-kick — proof-of-pattern for the bulk-* command family
([#1802](#1802))
([1c11f3e](1c11f3e))
* **bot:** add lucky_bot_gateway_connected zombie-detection gauge
([#1774](#1774))
([6cc5287](6cc5287))
* **bot:** playback progress bar in nowplaying/songinfo embed
([#1797](#1797))
([1138b59](1138b59))
* **bot:** post server-count stats to Top.gg for listing visibility
([#1789](#1789))
([e8ca6b9](e8ca6b9))
* **bot:** temporary support ticket channels (/ticket)
([#1803](#1803))
([49601a1](49601a1))
* **live-notif:** youtube polling, message ttl cleanup, api backoff
([#1762](#1762))
([a99b85a](a99b85a))
* **remind:** channel and role broadcast reminders
([#1767](#1767))
([#1807](#1807))
([83ade79](83ade79))


### Bug Fixes

* **backend:** artist suggestions 503 not 500 on upstream timeout
([#1787](#1787))
([eadc20e](eadc20e))
* **bot:** guard skipReason telemetry against null prisma client
([#1773](#1773))
([d73421e](d73421e))
* **ci:** stop auto-update workflow racing on merge push
([#1811](#1811))
([2ddd202](2ddd202))
* **csp:** allow Cloudflare Insights beacon in script-src/connect-src
([#1788](#1788))
([f20c4cf](f20c4cf))
* **deps:** bump eslint in lock to satisfy npm@12 ci (unblock release)
([#1809](#1809))
([68fd0be](68fd0be))
* paginate bulk-move message fetch to respect discord api limit
([#1776](#1776))
([5b5d2fc](5b5d2fc))
* **weekly-digest:** trigger on Sunday and add new-guides RSS section
([#1761](#1761))
([f429fc6](f429fc6))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
This was referenced Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(bot): post server-count stats to Top.gg for listing visibility (PRIORITY)

2 participants