# 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](https://cdn.discordapp.com/attachments/690492442050297886/1529539532419104909/image.png?ex=6a624e31&is=6a60fcb1&hm=9f6558980e43cb6132a75378137015a32ef2429be4a1618cd5cbee8a9d9cd052&) ## Setup Guide ### 1. Install Dependencies This project uses **uv** for fast dependency management. Install the required packages into your virtual environment: ```bash 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: ```env 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`: ```bash 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. |