mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-29 13:27:47 +00:00
Update docs to use bot_token parameter
This commit is contained in:
parent
149130831b
commit
5edd971118
@ -92,18 +92,19 @@ and as long as you keep the session alive, Pyrogram won't ask you again to enter
|
||||
Bot Authorization
|
||||
-----------------
|
||||
|
||||
Bots are a special kind of users and are authorized via their tokens (instead of phone numbers), which are created by
|
||||
Bots are a special kind of users that are authorized via their tokens (instead of phone numbers), which are created by
|
||||
BotFather_. Bot tokens replace the Users' phone numbers only — you still need to
|
||||
`configure a Telegram API key <#configuration>`_ with Pyrogram, even when using Bots.
|
||||
|
||||
The authorization process is automatically managed. All you need to do is pass the bot token as ``session_name``.
|
||||
The session file will be named after the Bot user_id, which is ``123456.session`` for the example below.
|
||||
The authorization process is automatically managed. All you need to do is choose a ``session_name`` (can be anything,
|
||||
but is usually your bot username) and pass your bot token using the ``bot_token`` parameter.
|
||||
The session file will be named after the session name, which will be ``pyrogrambot.session`` for the example below.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from pyrogram import Client
|
||||
|
||||
app = Client("123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11")
|
||||
app = Client("pyrogrambot", bot_token="123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11")
|
||||
app.run()
|
||||
|
||||
.. _installed Pyrogram: Installation.html
|
||||
|
@ -183,7 +183,8 @@ class Client(Methods, BaseClient):
|
||||
|
||||
terms_of_service_displayed = False
|
||||
|
||||
def __init__(self,
|
||||
def __init__(
|
||||
self,
|
||||
session_name: str,
|
||||
api_id: Union[int, str] = None,
|
||||
api_hash: str = None,
|
||||
@ -207,7 +208,8 @@ class Client(Methods, BaseClient):
|
||||
config_file: str = BaseClient.CONFIG_FILE,
|
||||
plugins: dict = None,
|
||||
no_updates: bool = None,
|
||||
takeout: bool = None):
|
||||
takeout: bool = None
|
||||
):
|
||||
super().__init__()
|
||||
|
||||
self.session_name = session_name
|
||||
|
Loading…
x
Reference in New Issue
Block a user