This Telegram bot allows users to download songs from Spotify and share currently playing songs in a Telegram chat. It utilizes the Pyrogram library for interacting with the Telegram API and SQLite database for managing downloaded songs.
- Download songs from Spotify.
- Share currently playing songs in a Telegram chat.
- Automatically delete duplicate songs.
Click to expand!
Before running the bot, configure the following settings in the config.py
file:
- Spotify API credentials
- Telegram API credentials
- Bot settings (e.g.,
USER_BOT
,STRING_SESSION
,CHAT_ID
,WORKERS
)
In the config.py
file, there is a parameter named USER_BOT
which determines whether the userbot mode should be activated in addition to the bot mode.
-
When
USER_BOT
is set toTrue
:- Both the bot and the userbot modes will be active.
- The userbot mode will be activated and songs previously sent in the channel specified by
CHAT_ID
will be prevented from being resent by saving them to the database. - It will require providing the session string (
STRING_SESSION
) specified in theconfig.py
file. To get it, run this command:python stringsession.py
-
When
USER_BOT
is set toFalse
:- Only the bot mode will be active.
- The bot will run without activating the userbot mode.
- If there are songs previously sent in the channel specified by
CHAT_ID
, the bot may resend them.
Log messages are formatted with colors indicating the log level.
By default, log messages are printed to the console.
You can enable file logging by setting the LOG_TO_FILE
parameter to True
in the config.py
file and specifying the log file path using the LOG_FILE_PATH
parameter.
Make sure to configure the config.py
file according to your preference before running the bot.
Click to view installation steps.
- Clone the repository:
git clone https://github.com/suphiozturk8/SpotifyTg.git && cd SpotifyTg
- Create a virtual environment and activate it:
- Windows:
python -m venv myenv myenv\Scripts\activate
- Linux/Mac:
python -m venv myenv source myenv/bin/activate
- Windows:
- Install dependencies:
pip install -r requirements.txt
- Set up your configurations in the
config.py
file. - Run the bot:
python -m spotify_tg
Contributions are welcome! Follow these steps to contribute:
- Fork the repository.
- Create a new branch:
git checkout -b feature/new-feature
. - Make your changes and commit:
git commit -m "Add new feature"
. - Push to the branch:
git push origin feature/new-feature
. - Submit a pull request.
This project is licensed under the MIT License.