A headless Discord Rich Presence client for Last.fm
Find a file
2025-08-30 12:50:12 -04:00
.github/workflows fix actions v3 2025-08-29 20:18:59 -04:00
.gitignore revamp album art 2025-08-29 21:22:36 -04:00
compose-dev.yaml Lastcord 2025-08-29 20:05:23 -04:00
compose.yaml Lastcord 2025-08-29 20:05:23 -04:00
config.py Lastcord 2025-08-29 20:05:23 -04:00
Dockerfile revamp album art 2025-08-29 21:22:36 -04:00
env.example fix album art 2025-08-29 20:39:49 -04:00
main.py fixes 2025-08-29 21:42:47 -04:00
package.json revamp album art 2025-08-29 21:22:36 -04:00
README.md add troubleshooting section to README for Discord token issues 2025-08-30 12:50:12 -04:00
requirements.txt Lastcord 2025-08-29 20:05:23 -04:00
rpc.py fix album art 2025-08-29 20:39:49 -04:00

Lastcord

Docker Image

A headless Discord Rich Presence client for Last.fm, with automatic album art fetching and timestamps.

Necessary setup

Create an .env file with the following variables:

Variable Description Example value
DISCORD_CLIENT_ID Your Discord user ID 805831541070495744
DISCORD_TOKEN Your Discord account token Mzg5NjkzNzA5MzQ4MTQ2NzY4.DM9aRQ
LASTFM_API_KEY Your last.fm API key 098f6bcd4621d373cade4e832627b4f6
SPOTIFY_CLIENT_ID Your Spotify app ID abc123def456ghi789
SPOTIFY_CLIENT_SECRET Your Spotify app secret xyz789abc123def456

Finding Your Discord Token and Client ID

Discord Token: Follow this guide to find your Discord token from the browser developer console.

Discord Client ID (User ID):

  1. Open Discord in your browser
  2. Press F12 to open Developer Tools
  3. Go to the Application tab
  4. In the left sidebar, expand Local Storage and click on https://discord.com
  5. Look for the MultiAccountStore key
  6. Your user ID will be in the value of that key

Spotify and Last.fm API Keys: For creating Spotify and Last.fm seccrets, refer to the Navidrome External Integrations guide.

Troubleshooting

If the application suddenly stops working: It's likely because you recently signed out of the Discord session from which you created the Discord token. You will need to create a new token and avoid signing out of that session for the application to continue working properly.

Other setup

There are also a few other variables that can be set in the environment file:

Variable Description Possible Values
ACTIVITY_NAME Sets the activity name ARTIST, ALBUM, TRACK, any string
POLLING_TIME How frequently we check Last.fm for updates Any positive integer
LASTFM_ENDPOINT Custom Last.fm endpoint Valid Last.fm API endpoint

Last.fm Endpoint

The Last.fm endpoint defaults to biancarosa's endpoint. You can run your own endpoint using https://github.com/biancarosa/lastfm-last-played

Run the server

To run the server with Docker Compose, first create a compose.yml file:

services:
  lastcord:
    image: ghcr.io/z0xca/lastcord:latest
    container_name: lastcord
    restart: unless-stopped
    env_file:
      - .env

Then run the server using:

docker compose up -d

To stop the server:

docker compose down

Contributing

If you find a bug or have a suggestion, please open an issue. If you want to contribute, please fork the repository and create a pull request. Thanks!

Credits

This project is based on the initial structure from @logixism/navicord

Note for Navidrome Users

If your goal is to only sync with Navidrome and not Last.fm, consider using: