Telegram Bots API wrapper.
Project description
Getting new messages and answer
from py_telegram_bot.bot import Bot
bot = Bot('Token')
api = bot.get_api()
for update in bot.get_updates():
# Here you can use "update['text']"
if update.text == '/start':
# And here you can use "update['chat']['id']"
api.send_message(chat_id=update.chat.id,
text='Hello!')
Uploading photo, videos or docs
from py_telegram_bot.bot import Bot
bot = Bot('Token')
uploader = bot.get_uploader()
for update in bot.get_updates():
if update.text == 'video':
uploader.send_video(update.chat.id,
# or use here video id
open('video.mp4', 'rb'))
elif update.text == 'photo':
uploader.send_photo(update.chat.id,
# or use here photo id
open('photo.png', 'rb'))
elif update.text == 'doc':
uploader.send_photo(update.chat.id,
# or use here doc id
open('doc.zip', 'rb'))
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for py-telegram-bot-1.0.post3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f83507c6251aebd3bd172bbb276ea3cff3f7e30b473bf8535922245a9405c6ab |
|
MD5 | 55dd61a2cec5f4744007dcf86e0e8029 |
|
BLAKE2b-256 | cbc6ca350ebcb2d0c7c0ae6cc2a08fcd52b4f02eb53623893590d29128075e18 |
Close
Hashes for py_telegram_bot-1.0.post3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 81ccea959c8af8adeaa8ba07a4d77c55676a076910bb96ad23b994ea6d4f3941 |
|
MD5 | b045b3fda502900c5603da5f27e5fed2 |
|
BLAKE2b-256 | 3c414208d424210b377b7aac927b8b6faa2799bcaf31928b62273e1ead5ccf09 |