Skip to main content

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'))

Metadata

Release files for py-telegram-bot 1.0.post3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py-telegram-bot 1.0.post3
File Size Uploaded
py-telegram-bot-1.0.post3.tar.gz 3.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for py-telegram-bot 1.0.post3
File Interpreter ABI Platform
py_telegram_bot-1.0.post3-py3-none-any.whl Python 3 none any Details

Total release size: 19.5 kB

Release files / py-telegram-bot-1.0.post3.tar.gz

Download URL py-telegram-bot-1.0.post3.tar.gz
Size 3.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f83507c6251aebd3bd172bbb276ea3cff3f7e30b473bf8535922245a9405c6ab
BLAKE2b-256 checksum
How to use checksums
cbc6ca350ebcb2d0c7c0ae6cc2a08fcd52b4f02eb53623893590d29128075e18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

Release files / py_telegram_bot-1.0.post3-py3-none-any.whl

Download URL py_telegram_bot-1.0.post3-py3-none-any.whl
Size 16.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
81ccea959c8af8adeaa8ba07a4d77c55676a076910bb96ad23b994ea6d4f3941
BLAKE2b-256 checksum
How to use checksums
3c414208d424210b377b7aac927b8b6faa2799bcaf31928b62273e1ead5ccf09
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

Release history Release notifications | RSS feed

This release

1.0.post3 This release

2 release files

1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page