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.

Source Distribution

py-telegram-bot-1.0.post3.tar.gz (3.0 kB view hashes)

Uploaded source

Built Distribution

py_telegram_bot-1.0.post3-py3-none-any.whl (16.6 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page