Skip to main content

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.

Files for py-telegram-bot, version 1.0.post3
Filename, size File type Python version Upload date Hashes
Filename, size py_telegram_bot-1.0.post3-py3-none-any.whl (16.6 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size py-telegram-bot-1.0.post3.tar.gz (3.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page