Skip to main content

Telegram Bot to share music with Odesli (former Songlink) service.

Project description

Telegram Odesli Bot

Send a song link in any (supported) music streaming service and get back a message with links in other services.

Add in Telegram: @odesli_bot

It's useful but still work in progress. Some turbulence is expected.

PyPI Azure build status Code coverage Docker build Supported versions License: GPL v3 Codestyle: Black

What is it for?

You love to share music with your friends (or be shared with), but you settled in different streaming services? With the help of this bot you can share any song link to the Bot and get all other links back in reply.

Powered by the great Odesli (former Songlink) service.

You can message the bot directly, invite it to group chats or use an inline mode (type @odesli_bot <URL>). In group chats the bot will react only to messages with music streaming links (it will also skip messages marked with special token !skip). You can promote the bot to a group admin and it will remove original message so that the chat remains tidy.

Original message Bot's replay
Original message Bot's reply

Features

  • Inline mode
  • Private chat mode
  • Group chat mode

Supported services

Currently the following services are supported:

  • Deezer
  • Google Music
  • SoundCloud
  • Yandex Music
  • Spotify
  • YouTube Music
  • YouTube
  • Apple Music
  • Tidal

Privacy considerations

The bot have to have access to messages in group chats to operate (that is, it operates with disabled privacy mode). It does not store nor transfer messages anywhere. However, the only way to be completely private is to read through source code in this repository and run your copy of the bot (see section below). Or simply create a special group only for music sharing and where no sensitive information will be posted.

Running your own copy

Prerequisites

You need a Telegram bot token to run your copy of the bot. Don't worry, it can be obtained easily. Follow the instructions to create a new bot (you can set a name and a username to whatever you want). All you need is a string like 110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw - this is your new bot token.

Additionally, disable privacy mode for your bot in a dialog with @BotFather: "Group Privacy" - "Turn off" (that is for the bot to be able to read group messages).

Bot from this repository will looks for TG_ODESLI_BOT_TG_API_TOKEN environment variable on start, thus you must set it either in shell or via .env file:

$ echo "<your_token>" > .env
$ # OR
$ TG_ODESLI_BOT_TG_API_TOKEN=<your_token> <bot_run_command (see below)>

Ones you obtain a Telegram bot token, you can run bot using either Python (3.7 or 3.8) or Docker.

Run PyPI version

Create virtual environment, install tg-odesli-bot package and run the bot with tg-odesli-bot command:

$ python -m venv botenv
$ source botenv/bin/activate
$ pip install tg-odesli-bot
$ TG_ODESLI_BOT_TG_API_TOKEN=<your_token> tg-odesli-bot

Run with Docker

Set TG_ODESLI_BOT_TG_API_TOKEN environment variable and run the image 9dogs/tg-odesli-bot (in order to use the .env file, mount it to /opt/tg-odesli-bot/.env):

$ docker run --rm -it -v /path/to/.env:/opt/tg-odesli-bot/.env 9dogs/tg-odesli-bot
# OR
$ TG_ODESLI_BOT_TG_API_TOKEN=<your_token> docker run -it --rm 9dogs/tg-odesli-bot

Run version from the repository

Clone this repository, install poetry, copy .env file into the project's root directory and run the bot:

$ git clone https://github.com/9dogs/tg-odesli-bot.git && cd tg-odesli-bot
# Install dependencies
$ poetry install
# If you have token in .env file
$ cp /path/to/.env ./
$ poetry run tg-odesli-bot
# If you specify token via shell env var
$ TG_ODESLI_BOT_TG_API_TOKEN=<your_token> poetry run tg-odesli-bot

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tg_odesli_bot-0.2.9.tar.gz (27.8 kB view hashes)

Uploaded Source

Built Distribution

tg_odesli_bot-0.2.9-py3-none-any.whl (26.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page