feat: add Last.fm integration with auto-scrobbling

- Add LastFmManager with full Last.fm API auth flow (get token →
  user authorises → get session key stored in MySQL)
- Add %lastfm command (aliases: lf, lfm) with subcommands:
  link, confirm, unlink, np, profile, loved, top, recent, scrobble
- Auto-scrobble in PlayerManager: sends now-playing notification to
  all human voice-channel members on track start, then defers a
  scrobble after the configured threshold (default 50% of duration
  or 4 min, whichever comes first)
- Add lastfm config block to config_example.json (apiKey,
  apiSecret, scrobbleThreshold, scrobbleMinMs)
- Add all Last.fm locale strings to storage/locales/bot/en.json

fix: show channel as Discord mention in inactivity leave message

- RecoveryManager: changed plain activeChannelId to
  <#activeChannelId> so it renders as a clickable channel link
This commit is contained in:
NoLogicAlan committed 2026-05-09 23:47:50 +03:00
1 parent 09fa5d160c
commit 8ac0dde343
8 files changed
+960 -3

No files matched your search

+6
View File
@@ -14,6 +14,7 @@ import { Dashboard } from "./src/dashboard/Dashboard.mjs";
import { Locale } from "./src/constants/Locale.mjs";
import { RecoveryManager } from "./src/RecoveryManager.mjs";
import { GatewayHandler } from "./src/GatewayHandler.mjs";
import { LastFmManager } from "./src/LastFmManager.mjs";
export class Remix {
constructor() {
@@ -146,6 +147,10 @@ export class Remix {
// are active before the first Ready event fires.
this.gatewayHandler.setupEventHandlers();
// ── Last.fm Manager ─────────────────────────────────────────────────────
// Handles Last.fm API auth, scrobbling, and user data.
this.lastfm = new LastFmManager(config.lastfm, config.mysql);
// ── Settings ready callback ──────────────────────────────────────────────
settings.on("ready", () => {
initLogger(config);
@@ -258,6 +263,7 @@ export class Remix {
timers: this.T,
});
this.players.observedVoiceUsers = this.observedVoiceUsers;
this.players._lastfm = this.lastfm;
// ── Periodic alone-check ───────────────────────────────────────────────────
const ALONE_CHECK_INTERVAL = this.T.aloneCheckInterval;