Skip to main content

Python library to help you build your own Telegram clients

Project description

python-telegram-client

Build Status PyPI DockerHub Read the Docs (version)

This is a fork of alexander-akhmetov/python-telegram. The root package is renamed from "telegram" to "teleclient" to avoid name conflict with python-telegram-bot.

Installation

This library requires Python 3.6+ and Linux or MacOS.

pip install python-telegram-client

See documentation for more details.

How to use

Have a look at the tutorial :)

Basic example:

from teleclient.client import Telegram
from teleclient.text import Spoiler

tg = Telegram(
    api_id='api_id',
    api_hash='api_hash',
    phone='+31611111111',  # you can pass 'bot_token' instead
    database_encryption_key='changekey123',
    files_directory='/tmp/.tdlib_files/',
)
tg.login()

# if this is the first run, library needs to preload all chats
# otherwise the message will not be sent
result = tg.get_chats()
result.wait()

chat_id: int
result = tg.send_message(chat_id, Spoiler('Hello world!'))
# `tdlib` is asynchronous, so `python-telegram` always returns you an `AsyncResult` object.
# You can receive a result with the `wait` method of this object.
result.wait()
print(result.update)

tg.stop()  # you must call `stop` at the end of the script

More examples you can find in the /examples/ directory.


More information in the documentation.

Development

See CONTRIBUTING.md.

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

python-telegram-client-0.17.0.post0.tar.gz (15.6 MB view details)

Uploaded Source

Built Distribution

python_telegram_client-0.17.0.post0-py2.py3-none-any.whl (15.7 MB view details)

Uploaded Python 2 Python 3

File details

Details for the file python-telegram-client-0.17.0.post0.tar.gz.

File metadata

File hashes

Hashes for python-telegram-client-0.17.0.post0.tar.gz
Algorithm Hash digest
SHA256 b91a1b440374cdbb087da3116e8de59ac8ad0f4a5f124412a710426ea7c301d2
MD5 42cec0fa5f2267376aad8679db48c68f
BLAKE2b-256 5707b1549360429e68edb747285e746252082d7e5a20212b07d184b9dfb4861d

See more details on using hashes here.

File details

Details for the file python_telegram_client-0.17.0.post0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for python_telegram_client-0.17.0.post0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 32b845fab177a2500f92199dc0b33ca8d80c06c9cdd010eef2b4074008d6602f
MD5 1e904cc4fc1390741325d55a3ceb73bb
BLAKE2b-256 62df410512ea863819067d4d15854dd2dae8d1e943773cb695a6ac0477904813

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