This project is a Telegram bot that interacts with the Spotify API to provide various functionalities. The bot can authorize a user, fetch the current track, favorite tracks, favorite albums, and playlist information.
Currently, my application is in Developer Mode on the Spotify Developer Dashboard. This means that in order for users to use the application, they need to be manually added by me. If you wish to use my application, please contact me so I can add you to the list of authorized users. I appreciate your understanding and cooperation.
The bot supports the following commands:
/authorize: Authorizes the user.
/gettrack: Fetches the current track.
/gettracks: Fetches the user's favorite tracks.
/getalbums: Fetches the user's favorite albums.
/getplaylists: Fetches the user's playlists.
/help: Provides a list of available commands.
To run this project, you need to create an appsettings.json file in the root directory with the following structure:
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"Spotify": {
"ClientId": "<Your Spotify Client ID>",
"ClientSecret": "<Your Spotify Client Secret>",
"RedirectUri": "http://localhost:8000/callback"
},
"Telegram": {
"Token": "<Your Telegram Bot Token>"
}
}
Replace "" , and with your actual Spotify Client ID, Spotify Client Secret, and Telegram Bot Token respectively.
After setting up the appsettings.json file, you can run the project using your preferred .NET Core-compatible IDE or from the command line with the dotnet run command.
-
Make sure you have Docker installed on your machine. If not, you can download it from here.
-
Navigate to the root directory of the project in your terminal.
-
Build the Docker image from the Dockerfile:
docker build -t telegrambotforspotify .
-
Run the Docker container, mapping the application's port 80 to port 5001 on the host machine:
docker run -p 8000:80 -d telegrambotforspotify
-
Open a Telegram, find StrangerSpotifyBot and start it.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Bohdan Harabadzhyu