aboutsummaryrefslogtreecommitdiff

Spotify Discord Profile Widget Bot

A Discord bot that connects Spotify accounts to update Discord Profile Identity widgets with real-time listening statistics (Top Songs, Top Artists, Top Albums, and Recently Liked tracks).


League Widget Preview

Setup Guide

1. Install Dependencies

This project uses uv for fast dependency management.

Install the required packages into your virtual environment:

uv pip install discord.py spotipy aiohttp python-dotenv

(If you are managing the project using a pyproject.toml file, you can run uv sync instead.)

2. Environment Configuration

Create a .env file in the root directory and add your API credentials:

SPOTIFY_CLIENT_ID=your_spotify_client_id
SPOTIFY_CLIENT_SECRET=your_spotify_client_secret
SPOTIFY_REDIRECT_URI=http://localhost:8888/callback

DISCORD_BOT_TOKEN=your_discord_bot_token
DISCORD_APP_ID=your_discord_application_id

Note: Ensure http://localhost:8888/callback is listed under the Redirect URIs in your Spotify Developer Dashboard settings.


Running the Bot

Run the bot script directly using uv:

uv run main.py

Bot Commands

Command Description
/spotify_login Generates a Spotify authorization link to start account linking.
/submit_code Submits the OAuth code or callback URL to finish linking your account.
/range Sets the preferred timeframe for statistics (e.g. 7d, 4w, 6m, 1y).
/update_widget Forces an immediate refresh of your Discord profile widget payload.