Add python-telegram-bot (#226)

* Add python-telegram-bot

Update

Update bot.py

* Update bot.py

* Update requirements.txt
This commit is contained in:
Agampreet Singh
2022-02-17 09:53:01 +05:30
committed by GitHub
parent 75b006c246
commit 4d38f0b362
4 changed files with 45 additions and 0 deletions

View File

@@ -0,0 +1 @@
web: python bot.py

View File

@@ -0,0 +1,28 @@
---
title: Python Telegram Bot
description: A Telegram Bot Written in Python
tags:
- python
- python-discord-bot
- telegram
---
# Python-Telegram-Bot
This example starts a Telegram bot using [python-telegram-bot](https://www.python-telegram-bot.org/) library.
[![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/new/template?template=https%3A%2F%2Fgithub.com%2Frailwayapp%2Fexamples%2Ftree%2Fmaster%2Fexamples%2Fpython-telegram-bot&envs=TOKEN&TOKENDesc=The+Telegram+Bot%27s+Token+%28Generate+a+token+from+%40BotFather+if+you+don%27t+have+one%21%29)
## ✨ Features
- Python
- Python Telegram Bot
## 💁‍♀️ How to use
- Install packages using `pip install -r requirements.txt`
- Start the bot using `python bot.py`
## 📝 Notes
This is a basic bot with the command `/start`, more information can be founded at the [offical documentation](https://python-telegram-bot.readthedocs.io/en/stable/).

View File

@@ -0,0 +1,15 @@
from telegram import Update
from telegram.ext import Updater, CommandHandler, CallbackContext
import os
def start(update: Update, context: CallbackContext) -> None:
update.message.reply_text(f'Hello {update.effective_user.first_name}\nI am a sample Telegram bot made with python-telegram-bot!')
updater = Updater(os.environ.get("TOKEN"), use_context=True)
updater.dispatcher.add_handler(CommandHandler('start', start))
print("Bot started successfully")
updater.start_polling()
updater.idle()

View File

@@ -0,0 +1 @@
python-telegram-bot