Skip to content

mrvaart23/Python-Telegram.Bot-WebHook

 
 

Repository files navigation

Python-Telegram.Bot-WebHook.

Telegram Bot (Python 3 / Ngrok / WebHook)

Info

This is Telegram Bot, written in Python language with WebHook.
Answer comes to the local Flask server through the Ngrok service.
Server automatically receives a new Ngrok address and updates it in the Telegram WebHook, so run Ngrok first.
This project is under-development, but it works as example, I was just too lazy to make it beautiful ;D.

Install/Uninstall/Run

> python setup.py install

> pip uninstall telegram_bot

Windows:
> ngrok.exe http 5000
> telegram_bot.exe

Linux:
> ngrok http 5000
> telegram_bot


ngrok: https://62f3bc0d.ngrok.io/webhook
webhook: https://0b0477ff.ngrok.io/webhook
ngrok != webhook, setting up webhook url
ngrok: https://62f3bc0d.ngrok.io/webhook
webhook: https://62f3bc0d.ngrok.io/webhook
url's is equal, starting flask
 * Serving Flask app "telegram_bot.core" (lazy loading)
 * Environment: production
   WARNING: Do not use the development server in a production environment.
   Use a production WSGI server instead.
 * Debug mode: off

Use manually

Install Requirements

> pip install -r requirements.txt

Usage

- create bot and get token
- set token in telegram_bot/core.py file
- run ngrok
- run server
- enjoy

Unittest

> python -m unittest tests/test_data.py

Ngrok screenshot

Alt text

Bot screenshot

Alt text

About

Telegram Bot (Python 3 / Flask / Ngrok / WebHook)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%