Giter Site home page Giter Site logo

dmitrytokyo / book-bot Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 92 KB

Telegram chat bot, based on flask (webhook)

License: MIT License

Dockerfile 0.98% Python 96.65% HTML 1.50% Shell 0.60% Makefile 0.27%
flask telegram-bot python3 webhook doker nginx docker-compose

book-bot's Introduction

Book webhook bot

About

The Book Webhook Bot searches in several resources. Bot was based on Flask framework and working via webhook. Books are sent to Telegram.

Requirements

  • Programming language - Python 3.8.5.
  • Webhook was built on - Flask.
  • Telegram bot library - Python-telegram-bot.
  • Cache is using - Redis database.

Installation

  1. Clone this repository git clone https://github.com/DmitryTokyo/quotes.git.
  2. Create virtual environment python3 -m venv venv and activate source venv/bin/activate.
  3. Install all dependencies pip install -r requirements.txt
  4. Create .env file and put there following variables:
    • TG_TOKEN - telegram bot token. You can get it by using @BotFather bot.
    • DATABASE_PASSWORD - Redis database password.
    • DATABASE_HOST - Redis database host.
    • DATABASE_PORT - Redis database port.
  5. Webhook method needs public IP address or domain, but in a local computer you can use ngrok technology. For this way you can start the ngrok server by the command ./ngrok http 5000 and https link assign to URL variable in .env file.
  6. You need to tell your terminal the main flask application to work with by exporting the FLASK_APP and set debug mode by exporting the FLASK_ENV:
    export FLASK_APP=app.py
    export FLASK_ENV=development
    You can create .flaskenv instead it.

Usage

  1. Start the ./ngrok http 5000 and put to .env https link.
  2. Start the app by command flask run.
  3. Set up your webhook to follow the url. You can see in your browser webhook setup ok!!!.
  4. Send your bot /start.

License

Code licensed under MIT License.

book-bot's People

Contributors

dmitrytokyo avatar

Watchers

 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.