pyrogram/README.rst

132 lines
4.7 KiB
ReStructuredText
Raw Normal View History

2017-12-10 19:43:31 +00:00
|header|
2018-06-24 12:22:50 +00:00
Pyrogram
========
2017-12-10 19:43:31 +00:00
2018-04-16 17:56:24 +00:00
.. code-block:: python
2017-12-10 19:43:31 +00:00
2018-04-16 17:56:24 +00:00
from pyrogram import Client, Filters
2017-12-11 07:59:11 +00:00
2018-04-16 17:56:24 +00:00
app = Client("my_account")
2017-12-10 19:43:31 +00:00
2018-04-16 17:56:24 +00:00
@app.on_message(Filters.private)
def hello(client, message):
2018-06-23 12:26:23 +00:00
message.reply("Hello {}".format(message.from_user.first_name))
2017-12-10 19:43:31 +00:00
2018-06-22 11:41:06 +00:00
app.run()
2017-12-10 19:43:31 +00:00
2019-01-24 19:00:59 +00:00
**Pyrogram** is an elegant, easy-to-use Telegram_ client library and framework written from the ground up in Python and C.
2019-02-04 12:04:57 +00:00
It enables you to easily create custom apps using both user and bot identities (bot API alternative) via the `MTProto API`_.
2019-02-11 12:20:06 +00:00
`Pyrogram in fully-asynchronous mode is also available » <https://github.com/pyrogram/pyrogram/issues/181>`_
2019-02-16 17:22:24 +00:00
`Working PoC of Telegram voice calls using Pyrogram » <https://github.com/bakatrouble/pytgvoip>`_
2017-12-10 19:43:31 +00:00
2018-01-01 20:47:12 +00:00
Features
--------
2017-12-10 19:43:31 +00:00
2019-02-04 12:04:57 +00:00
- **Easy**: You can install Pyrogram with pip and start building your applications right away.
2019-01-24 19:00:59 +00:00
- **Elegant**: Low-level details are abstracted and re-presented in a much nicer and easier way.
2018-04-16 17:56:24 +00:00
- **Fast**: Crypto parts are boosted up by TgCrypto_, a high-performance library written in pure C.
2019-01-24 19:00:59 +00:00
- **Documented**: Pyrogram API methods, types and public interfaces are well documented.
- **Type-hinted**: Exposed Pyrogram types and method parameters are all type-hinted.
2019-03-24 17:59:56 +00:00
- **Updated**, to the latest Telegram API version, currently Layer 97 on top of `MTProto 2.0`_.
2019-01-24 19:00:59 +00:00
- **Pluggable**: The Smart Plugin system allows to write components with minimal boilerplate code.
- **Comprehensive**: Execute any advanced action an official client is able to do, and even more.
2017-12-10 19:43:31 +00:00
Requirements
2018-01-01 20:47:12 +00:00
------------
2017-12-10 19:43:31 +00:00
2018-03-24 16:22:57 +00:00
- Python 3.4 or higher.
2018-04-16 17:56:24 +00:00
- A `Telegram API key`_.
2017-12-10 19:43:31 +00:00
2018-04-16 17:56:24 +00:00
Installing
----------
2017-12-21 15:00:04 +00:00
2018-04-16 17:56:24 +00:00
.. code:: shell
2017-12-21 15:00:04 +00:00
2018-04-16 17:56:24 +00:00
pip3 install pyrogram
2018-01-08 05:45:07 +00:00
2019-02-04 12:04:57 +00:00
Resources
---------
2017-12-10 19:43:31 +00:00
2018-04-16 17:56:24 +00:00
- The Docs contain lots of resources to help you getting started with Pyrogram: https://docs.pyrogram.ml.
2019-01-24 19:00:59 +00:00
- Reading `Examples in this repository`_ is also a good way for learning how Pyrogram works.
2018-04-18 13:34:29 +00:00
- Seeking extra help? Don't be shy, come join and ask our Community_!
- For other requests you can send an Email_ or a Message_.
2018-01-08 05:45:07 +00:00
2018-04-16 17:56:24 +00:00
Contributing
------------
2017-12-10 19:43:31 +00:00
2018-06-24 12:22:50 +00:00
Pyrogram is brand new, and **you are welcome to try it and help make it even better** by either submitting pull
2018-03-24 16:22:57 +00:00
requests or reporting issues/bugs as well as suggesting best practices, ideas, enhancements on both code
and documentation. Any help is appreciated!
2017-12-10 19:43:31 +00:00
2018-04-16 17:56:24 +00:00
Copyright & License
-------------------
2017-12-10 19:43:31 +00:00
2019-01-03 17:27:47 +00:00
- Copyright (C) 2017-2019 Dan Tès <https://github.com/delivrance>
2018-04-16 17:56:24 +00:00
- Licensed under the terms of the `GNU Lesser General Public License v3 or later (LGPLv3+)`_
2017-12-10 19:43:31 +00:00
2018-03-24 16:22:57 +00:00
.. _`Telegram`: https://telegram.org/
2019-02-04 12:04:57 +00:00
.. _`MTProto API`: https://core.telegram.org/api#telegram-api
2018-04-16 17:56:24 +00:00
.. _`Telegram API key`: https://docs.pyrogram.ml/start/ProjectSetup#api-keys
2018-02-17 14:35:49 +00:00
.. _`Community`: https://t.me/PyrogramChat
2019-01-24 19:00:59 +00:00
.. _`Examples in this repository`: https://github.com/pyrogram/pyrogram/tree/master/examples
2017-12-15 08:48:14 +00:00
.. _`GitHub`: https://github.com/pyrogram/pyrogram/issues
2017-12-10 19:43:31 +00:00
.. _`Email`: admin@pyrogram.ml
2018-04-16 17:56:24 +00:00
.. _`Message`: https://t.me/haskell
2018-02-17 20:52:27 +00:00
.. _TgCrypto: https://github.com/pyrogram/tgcrypto
2019-02-04 12:04:57 +00:00
.. _`MTProto 2.0`: https://core.telegram.org/mtproto
2017-12-10 19:43:31 +00:00
.. _`GNU Lesser General Public License v3 or later (LGPLv3+)`: COPYING.lesser
.. |header| raw:: html
<h1 align="center">
2018-03-24 16:22:57 +00:00
<a href="https://github.com/pyrogram/pyrogram">
2018-09-19 15:47:14 +00:00
<div><img src="https://raw.githubusercontent.com/pyrogram/logos/master/logos/pyrogram_logo2.png" alt="Pyrogram Logo"></div>
2017-12-10 19:43:31 +00:00
</a>
</h1>
<p align="center">
2019-01-24 19:00:59 +00:00
<b>Telegram MTProto API Framework for Python</b>
2018-09-19 15:47:14 +00:00
2017-12-17 13:22:03 +00:00
<br>
2017-12-30 20:51:51 +00:00
<a href="https://docs.pyrogram.ml">
Documentation
</a>
2019-01-24 19:00:59 +00:00
<a href="https://github.com/pyrogram/pyrogram/releases">
Changelog
</a>
2018-01-07 12:11:14 +00:00
<a href="https://t.me/PyrogramChat">
2018-01-01 12:44:33 +00:00
Community
2018-02-19 14:12:19 +00:00
</a>
2018-10-16 13:13:30 +00:00
<br>
2017-12-12 09:49:44 +00:00
<a href="compiler/api/source/main_api.tl">
2019-03-24 17:59:56 +00:00
<img src="https://img.shields.io/badge/schema-layer%2097-eda738.svg?longCache=true&colorA=262b30"
2018-10-16 13:13:30 +00:00
alt="Schema Layer">
2017-12-10 19:43:31 +00:00
</a>
2018-02-17 14:35:49 +00:00
<a href="https://github.com/pyrogram/tgcrypto">
2018-10-16 13:13:30 +00:00
<img src="https://img.shields.io/badge/tgcrypto-v1.1.1-eda738.svg?longCache=true&colorA=262b30"
2019-01-24 19:00:59 +00:00
alt="TgCrypto Version">
2017-12-10 19:43:31 +00:00
</a>
</p>
2018-09-19 15:47:14 +00:00
.. |logo| image:: https://raw.githubusercontent.com/pyrogram/logos/master/logos/pyrogram_logo2.png
2017-12-12 09:49:44 +00:00
:target: https://pyrogram.ml
2017-12-10 19:43:31 +00:00
:alt: Pyrogram
2019-01-24 19:00:59 +00:00
.. |description| replace:: **Telegram MTProto API Framework for Python**
2017-12-10 19:43:31 +00:00
2019-03-24 17:59:56 +00:00
.. |schema| image:: https://img.shields.io/badge/schema-layer%2097-eda738.svg?longCache=true&colorA=262b30
2017-12-12 09:49:44 +00:00
:target: compiler/api/source/main_api.tl
2019-01-24 19:00:59 +00:00
:alt: Schema Layer
2017-12-10 19:43:31 +00:00
2019-02-04 15:29:13 +00:00
.. |tgcrypto| image:: https://img.shields.io/badge/tgcrypto-v1.1.1-eda738.svg?longCache=true&colorA=262b30
2018-02-17 14:35:49 +00:00
:target: https://github.com/pyrogram/tgcrypto
2019-01-24 19:00:59 +00:00
:alt: TgCrypto Version