Giter Club home page Giter Club logo

toptracksbot's Introduction

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.

toptracksbot's People

Contributors

dependabot[bot] avatar pltnk avatar

Stargazers

 avatar  avatar  avatar

Forkers

codacy-badger

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.