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

+32
View File
@@ -33,6 +33,7 @@
"invite": "Get the invite link for Remix and the support server.",
"join": "Make the bot join your voice channel, or specify one.",
"leave": "Make the bot leave your current voice channel.",
"lastfm": "Link your Last.fm account, toggle scrobbling, or view your profile.",
"list": "List the songs in the queue of your current voice channel.",
"loop": "Toggle the looping of your queue/song.",
"lyrics": "Display synced lyrics from NodeLink.",
@@ -61,6 +62,10 @@
"debug": {
"target": "The target that should be examined."
},
"lastfm": {
"action": "The action to perform: link, confirm, unlink, np, profile, loved, top, recent, scrobble",
"token": "The auth token from Last.fm (used with 'confirm' action)"
},
"eval": {
"expression": "The JavaScript expression to evaluate"
},
@@ -249,6 +254,33 @@
"leftRejoin247": "✅ Successfully Left — rejoining <#{{channel}}> in 5 seconds.\nTo disable 24/7 mode permanently, use `%247 off`.",
"left247On": "✅ Successfully Left.\n24/7 mode is **on** — bot won't rejoin automatically. Use `%play` to bring it back, or `%247 off` to fully disable.\nUse `%247` to view all saved channels."
},
"lastfm": {
"notConfigured": "❌ Last.fm integration is not configured on this bot. Ask the bot owner to add a Last.fm API key to the config.",
"notLinked": "❌ You don't have a Last.fm account linked. Use `{{prefix}}lastfm link` to get started.",
"linked": "✅ Last.fm account **[{{username}}](https://last.fm/user/{{username}})** linked! Scrobbling is enabled by default.",
"alreadyLinked": "✅ You already have **{{username}}** linked! Use `{{prefix}}lastfm unlink` to disconnect, or `{{prefix}lastfm scrobble` to toggle scrobbling.",
"unlinked": "✅ Last.fm account **{{username}}** has been unlinked.",
"scrobbleEnabled": "✅ Scrobbling **enabled** — songs you listen to will be scrobbled to **{{username}}**.",
"scrobbleDisabled": "⏸️ Scrobbling **disabled** — songs won't be scrobbled. Your account is still linked.",
"authDM": "📧 Check your DMs for the Last.fm authorization link! After approving, run `{{prefix}}lastfm confirm <token>` here.",
"authDMFailed": "⚠️ I couldn't DM you. [Click here to authorize on Last.fm]({{url}}), then run `{{prefix}}lastfm confirm <token>`.",
"confirmUsage": "❌ Usage: `{{prefix}}lastfm confirm <token>` — provide the token from the auth DM.",
"confirmFailed": "❌ Failed to get session: {{error}}\nMake sure you approved the token on Last.fm first.",
"tokenFailed": "❌ Failed to get auth token: {{error}}",
"noLoved": "❤️ No loved tracks found for **{{username}}**.",
"noTop": "📊 No top tracks found for **{{username}}**.",
"noRecent": "🕐 No recent tracks found for **{{username}}**.",
"lovedTitle": "❤️ Loved Tracks — {{username}}",
"topTitle": "📊 Top Tracks — {{username}}",
"recentTitle": "🕐 Recent Tracks — {{username}}",
"nowPlaying": "🎵 Now Playing on Last.fm",
"lastPlayed": "🕐 Last Played on Last.fm",
"profileTitle": "Last.fm Profile: {{username}}",
"profileScrobbles": "🎵 **{{playcount}}** scrobbles",
"profileRegistered": "👤 Registered: {{date}}",
"profileLink": "🔗 [Open profile]({{url}})",
"fetchFailed": "❌ Failed to fetch data from Last.fm: {{error}}"
},
"list": {
"empty": "📭 The queue is empty. Use `{{prefix}}play` to add songs!",
"emptyInline": "_Queue is empty._",