mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-01-24 08:14:14 +03:00
Rename invoke to __call__
This commit is contained in:
parent
36dabc4928
commit
c61e168de4
|
@ -406,7 +406,7 @@ class TelegramBareClient:
|
|||
|
||||
# region Invoking Telegram requests
|
||||
|
||||
def invoke(self, *requests, retries=5):
|
||||
def __call__(self, *requests, retries=5):
|
||||
"""Invokes (sends) a MTProtoRequest and returns (receives) its result.
|
||||
|
||||
The invoke will be retried up to 'retries' times before raising
|
||||
|
@ -441,6 +441,9 @@ class TelegramBareClient:
|
|||
if sender != self._sender:
|
||||
sender.disconnect() # Close temporary connections
|
||||
|
||||
# Let people use client.invoke(SomeRequest()) instead client(...)
|
||||
invoke = __call__
|
||||
|
||||
def _invoke(self, sender, call_receive, *requests):
|
||||
try:
|
||||
# Ensure that we start with no previous errors (i.e. resending)
|
||||
|
@ -524,9 +527,6 @@ class TelegramBareClient:
|
|||
self.disconnect()
|
||||
raise
|
||||
|
||||
# Let people use client(SomeRequest()) instead client.invoke(...)
|
||||
__call__ = invoke
|
||||
|
||||
# Some really basic functionality
|
||||
|
||||
def is_user_authorized(self):
|
||||
|
|
Loading…
Reference in New Issue
Block a user