.github/workflows | ||
.gitignore | ||
compose-dev.yaml | ||
compose.yaml | ||
config.py | ||
Dockerfile | ||
env.example | ||
main.py | ||
package.json | ||
README.md | ||
requirements.txt | ||
rpc.py |
Lastcord
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):
- Open Discord in your browser
- Press
F12
to open Developer Tools - Go to the Application tab
- In the left sidebar, expand Local Storage and click on https://discord.com
- Look for the MultiAccountStore key
- 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:
- @logixism/navicord - A dedicated Navidrome Discord Rich Presence client
- Navidrome Discord Rich Presence Plugin - Official Navidrome plugin for Discord integration