Python library to help you build your own Telegram clients
Project description
python-telegram-client
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for python-telegram-client-0.17.0.post0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b91a1b440374cdbb087da3116e8de59ac8ad0f4a5f124412a710426ea7c301d2 |
|
MD5 | 42cec0fa5f2267376aad8679db48c68f |
|
BLAKE2b-256 | 5707b1549360429e68edb747285e746252082d7e5a20212b07d184b9dfb4861d |
Close
Hashes for python_telegram_client-0.17.0.post0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 32b845fab177a2500f92199dc0b33ca8d80c06c9cdd010eef2b4074008d6602f |
|
MD5 | 1e904cc4fc1390741325d55a3ceb73bb |
|
BLAKE2b-256 | 62df410512ea863819067d4d15854dd2dae8d1e943773cb695a6ac0477904813 |