pltnk / toptracksbot

Telegram bot for discovering new music.

Home Page:https://t.me/toptracksbot

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Top Tracks Bot for Telegram

Telegram Build Status Codacy Badge codecov Code style: black License

This bot fetches videos from YouTube for the top three best tracks of all time by a specified artist according to Last.fm charts.

You can try it in Telegram: @toptracksbot

Usage

Just send an artist or a band name to the bot to get their top three tracks.

Available commands

  • /info artist_name or /i artist_name - get a short bio of an artist
  • /help or /h - show help message

Video preview

toptracksbot.mp4

Deployment

You can deploy this bot yourself using Docker and Docker Compose.

  1. Install Docker and Docker Compose

  2. Clone this repository

  3. Create .env file at the root of the cloned repo with the following variables declared there:

    Required:

    • TTBOT_TOKEN - Auth token of your Telegram bot (how to get)
    • TTBOT_LASTFM_API_KEY - Key for Last.fm API (how to get)
    • TTBOT_YOUTUBE_API_KEY - Key for YouTube API (how to get)

    Optional:

    • TTBOT_DATABASE_USER - Set a username for the database (default toptracks)
    • TTBOT_DATABASE_PASS - Set a password for the database (default toptracks)
    • TTBOT_DATABASE_PORT - Set a port for the database (default 5432)
    • TTBOT_VALID_FOR_DAYS - Number of days for which information about the artist's top three tracks is cached in the database (default 30)

    Check an example of .env file.

  4. Run tests using command docker compose run --rm tests; docker compose --profile test down --rmi all (this will run tests in a container and remove test containers and images afterward)

  5. Start the bot using command docker compose up -d (this will build images for the bot, database and start containers with them)

Built With

  • python-telegram-bot - This library provides a pure Python interface for the Telegram Bot API.
  • HTTPX - Fully featured HTTP client for Python 3, which provides sync and async APIs, and support for both HTTP/1.1 and HTTP/2.
  • asyncpg - A fast PostgreSQL Database Client Library for Python/asyncio.
  • Beautiful Soup 4 - Beautiful Soup is a library that makes it easy to scrape information from web pages.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Telegram bot for discovering new music.

https://t.me/toptracksbot

License:MIT License


Languages

Language:Python 97.2%Language:Dockerfile 2.7%Language:Procfile 0.1%