mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-05 20:50:22 +03:00
Refactor handle_migrate
This commit is contained in:
parent
d0e2e46c82
commit
92c115733d
|
@ -57,15 +57,11 @@ async def complete_login(client: Client, auth: abcs.auth.Authorization) -> User:
|
|||
async def handle_migrate(client: Client, dc_id: Optional[int]) -> None:
|
||||
assert client._sender
|
||||
assert dc_id is not None
|
||||
sender, client._session.dcs = await connect_sender(
|
||||
await client._sender.disconnect()
|
||||
client._sender, client._session.dcs = await connect_sender(
|
||||
client._config, client._session.dcs, DataCenter(id=dc_id)
|
||||
)
|
||||
|
||||
async with client._sender._step_lock:
|
||||
old_sender = client._sender
|
||||
client._sender = sender
|
||||
await old_sender.disconnect()
|
||||
|
||||
|
||||
async def bot_sign_in(self: Client, token: str) -> User:
|
||||
request = functions.auth.import_bot_authorization(
|
||||
|
|
Loading…
Reference in New Issue
Block a user