feat: add scrobble leaderboard and global Last.fm stats

- Add %lastfm leaderboard (alias: lb) command with paginated embed
  showing top users ranked by scrobble count with 🥇🥈🥉 medals;
  emoji reactions ◀️▶️❌ for navigation, auto-expires after timeout
- Add getLeaderboard() to LastFmManager: paginated query on
  scrobble_count DESC from lastfm_users, returns entries/totalPages
- Add syncUserScrobbleCount(): syncs local counter from Last.fm
  user.getinfo playcount; called on every %lastfm profile view
- Add _incrementScrobbleCount(): fire-and-forget increment of both
  per-user scrobble_count and global stored_scrobbles after each
  successful scrobble
- Add scrobble_count BIGINT column to lastfm_users with auto-migrate
  ALTER TABLE for existing installs (error silently ignored if
  column already exists)
- Add lastfm_stats table (single-row) tracking stored_scrobbles and
  linked_users globally; row is seeded with INSERT IGNORE on init
- Add getStoredScrobbles() and getLinkedUsersCount() with lazy
  in-memory caching for the stats row
- Add linked_users increment on first-time account link
- Show scrobble count and linked users in %stats embed when Last.fm
  is enabled (fetched in parallel, non-blocking on initial reply)
- Add locale keys responses.stats.scrobbles and
  responses.stats.linkedUsers to en, ar-SA, ckb, de-DE, pt-BR
This commit is contained in:
NoLogicAlan committed 2026-05-10 15:14:05 +03:00
1 parent 3e84002b79
commit e11c29ed25
3 files changed
+209 -10

No files matched your search

+1 -1
View File
@@ -123,7 +123,7 @@ Below is the complete list of Remix's commands. The default prefix is `%`.
| `stats` | Display bot stats (uptime, ping, player count, stored scrobbles) | `%stats` | `info` |
| `invite` | Get the bot invite link | `%invite` | `addbot`, `remix` |
| `support` | Get an invite to the support server | `%support` | `server` |
| `lastfm` | Link Last.fm, toggle scrobbling, view profile, play tracks | `%lastfm link` / `%lastfm play loved` | `lf`, `lfm` |
| `lastfm` | Link Last.fm, toggle scrobbling, view profile, play tracks, leaderboard | `%lastfm link` / `%lastfm play loved` / `%lastfm lb` | `lf`, `lfm` |
| `reload` | Reload commands or modules at runtime (owner) | `%reload` | |
| `servers` | List servers the bot is in (owner) | `%servers` | |
| `eval` | Evaluate JavaScript (owner only) | `%eval 1+1` | |