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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python-telegram-client-0.17.0.post0.tar.gz.
File metadata
- Download URL: python-telegram-client-0.17.0.post0.tar.gz
- Upload date:
- Size: 15.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b91a1b440374cdbb087da3116e8de59ac8ad0f4a5f124412a710426ea7c301d2
|
|
| MD5 |
42cec0fa5f2267376aad8679db48c68f
|
|
| BLAKE2b-256 |
5707b1549360429e68edb747285e746252082d7e5a20212b07d184b9dfb4861d
|
File details
Details for the file python_telegram_client-0.17.0.post0-py2.py3-none-any.whl.
File metadata
- Download URL: python_telegram_client-0.17.0.post0-py2.py3-none-any.whl
- Upload date:
- Size: 15.7 MB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32b845fab177a2500f92199dc0b33ca8d80c06c9cdd010eef2b4074008d6602f
|
|
| MD5 |
1e904cc4fc1390741325d55a3ceb73bb
|
|
| BLAKE2b-256 |
62df410512ea863819067d4d15854dd2dae8d1e943773cb695a6ac0477904813
|