Giter VIP home page Giter VIP logo

book-tg-bot's Introduction

TELEGRAM BOT BOOK๐Ÿ‘พ


While reading a course on creating telegram bots, I saw a comment from the person who created the telegram bot sea battle. I also wanted to create my own bot, but using modern technologies, libraries, databases and optimization.

Description


My project is a full-fledged bot created to read books directly from telegram. You can select a book, flip through the pages, go to the table of contents and select the desired page there, add pages to bookmarks, click on them and delete them. There are also convenient commands for going to the beginning of the book or continuing reading from the place where you finished.

Technologies

Language

Python

Framework

Aiogram

Databases

Postgres Redis

Libraries

SQLAlchemy Asyncio Aiocron Asyncpg aioredis Environs requests alembic

Other

Docker

I wrote a python bot using aiogram. I used two databases: Postgresql for storing user data, books and bookmarks, and Redis for caching data and optimizing work. The bot takes data about books via API from a third-party service and stores them in the database. With the help of the Aiocron library, the database is updated every hour. I also connected an alembic to initialize the database and create migrations

Project setup

Method 1: Via docker-compose

  1. Create a .env file and paste the data from the .env.example file into it
  2. In REDIS_HOST and POSTGRES_HOST, specify the names of docker-compose services (redis and db)
  3. In BOT_TOKEN, specify the token of your telegram bot created earlier via BotFather
  4. In the terminal, enter the following command:
docker-compose up --build

Method 2: Via virtual environment

  1. Create and activate a python virtual environment
  2. In the terminal, enter the following command:
pip3 install -r requirements.txt
  1. Create a .env file and paste the data from the .env.example file into it
  2. In REDIS_HOST and POSTGRES_HOST, specify localhost
  3. In BOT_TOKEN, specify the token of your telegram bot created earlier via BotFather
  4. In the terminal, enter the following command:
watchfiles --filter python 'python -m bot'

Thank you for taking the time to review my project. Enjoy reading!๐Ÿ‘‹

book-tg-bot's People

Contributors

brestok-1 avatar

Stargazers

J.P avatar

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.