Skip to main content

This module should help you controlling the telegram bot API.

Project description

Telegram Bot API Library

Requirements

Errors and Exceptions

  • BotNotExistsError: When the bot not exists, this error will raise.
  • NoInternetConnectionError: When the computer has no Internet, this error will raise.

Help

If you need help, just type python -m py_telegram --help to the shell.

Installation

For installing this library as python module, you just need to run install.py.

If you want to uninstall, just type python -m py_telegram --uninstall to the shell. Then, the module will uninstall itself.

Usage and initalisation

import py_telegram
bot = telgrambot.bot(apikey: str)

Parameters

  • apikey: Required, string. The API-Key of your bot (like 1234:abcdefg).

Methods

Send a Text Message

You can send a Text message using the bot.sendTextMessage() Returns a dictionary with the response and the status code of the request as an integer.

Syntax:

bot.sendTextMessage(chat_id, text[, disable_web_page_preview = False, disable_notification = False, reply_to_message_id = None, allow_sending_without_reply = True, parse_mode = `MarkdownV2`])

Parameters:

  • chat_id: Required, integer or string. Unique identifier of the chat.

  • text: Required, string. The text to send as message.

  • disable_web_page_preview: Optional, bool. Disabels the link preview for this message. Default is False.

  • disable_notification: Optional, bool. Sends the message silently, when set to True. Default is False.

  • reply_to_message_id: Optional, integer. If the message is a reply, the ID of the original message. Set this parameter to None, if you don`t want to send the message as a reply. Default is None.

  • allow_sending_without_reply: Optional, integer. Sends the message even is the reply_to_message_id is invalid or not set. Default is True.

  • parse_mode: Optional, string. Mode for parsing entities in the message text. Must be set to:

    • MarkdownV2
    • HTML
    • Markdown

    Default is MarkdownV2

Get Updates

You can use this method to receive incoming updates. Returns a dictionary with the response and the status code of the request as an integer.

Syntax:

getUpdates([offset=None, limit=100, timeout=0, allowed_updates=[]])

Parameters:

  • offset: Required, integer. Identifier of the first update to be returned. Must be greater by one than the highest among the identifiers of previously received updates. By default, updates starting with the earliest unconfirmed update are returned. Default is None.
  • limit: Required, integer. Limits the number of updates to be retrieved. Values between 1-100 are accepted. Default to 100.
  • timeout: Required, integer. Timeout in seconds for long polling. Default is 0.
  • allowed_updates: Required, array/list of strings. For example, specify [“message”, “edited_channel_post”, “callback_query”] to only receive updates of these types. Default is a empty array (will not be sended as parameter, if the array is empty).

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-1.0.0.8.dev0.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

py_telegram-1.0.0.8.dev0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file py_telegram-1.0.0.8.dev0.tar.gz.

File metadata

  • Download URL: py_telegram-1.0.0.8.dev0.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.1

File hashes

Hashes for py_telegram-1.0.0.8.dev0.tar.gz
Algorithm Hash digest
SHA256 d1c81d0f59ab7808f18e889adb15758eaf34dac941510495dbed079add0ef22e
MD5 2259e25b66bf4a66de424b86a11a03e5
BLAKE2b-256 6f9f802733b0d6871e68f45f5b11d93b94c5880b6d9191bb9c44cbe6707e17da

See more details on using hashes here.

File details

Details for the file py_telegram-1.0.0.8.dev0-py3-none-any.whl.

File metadata

  • Download URL: py_telegram-1.0.0.8.dev0-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.1

File hashes

Hashes for py_telegram-1.0.0.8.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 d7faecd9fd6adf97d2e2a4ea625b40c8a0bc6f577f11504a207e6f1900fc3b44
MD5 6aef2fa118aeb2f7145e24301ae0bdac
BLAKE2b-256 d9b1bfae9569fd807d97287e21e024feab791e859e19e7f70ca4151892a20381

See more details on using hashes here.

Supported by

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