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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file py-telegram-bot-1.0.post3.tar.gz.

File metadata

  • Download URL: py-telegram-bot-1.0.post3.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for py-telegram-bot-1.0.post3.tar.gz
Algorithm Hash digest
SHA256 f83507c6251aebd3bd172bbb276ea3cff3f7e30b473bf8535922245a9405c6ab
MD5 55dd61a2cec5f4744007dcf86e0e8029
BLAKE2b-256 cbc6ca350ebcb2d0c7c0ae6cc2a08fcd52b4f02eb53623893590d29128075e18

See more details on using hashes here.

File details

Details for the file py_telegram_bot-1.0.post3-py3-none-any.whl.

File metadata

  • Download URL: py_telegram_bot-1.0.post3-py3-none-any.whl
  • Upload date:
  • Size: 16.6 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for py_telegram_bot-1.0.post3-py3-none-any.whl
Algorithm Hash digest
SHA256 81ccea959c8af8adeaa8ba07a4d77c55676a076910bb96ad23b994ea6d4f3941
MD5 b045b3fda502900c5603da5f27e5fed2
BLAKE2b-256 3c414208d424210b377b7aac927b8b6faa2799bcaf31928b62273e1ead5ccf09

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page