mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-02-05 14:10:56 +03:00
Syncify events too
This commit is contained in:
parent
ded24db3dd
commit
2d94a104d1
|
@ -13,6 +13,7 @@ from concurrent.futures import Future, ThreadPoolExecutor
|
||||||
|
|
||||||
from async_generator import isasyncgenfunction
|
from async_generator import isasyncgenfunction
|
||||||
|
|
||||||
|
from . import events
|
||||||
from .client.telegramclient import TelegramClient
|
from .client.telegramclient import TelegramClient
|
||||||
from .tl.custom import (
|
from .tl.custom import (
|
||||||
Draft, Dialog, MessageButton, Forward, Message, InlineResult, Conversation
|
Draft, Dialog, MessageButton, Forward, Message, InlineResult, Conversation
|
||||||
|
@ -113,8 +114,13 @@ def enable(*, loop=None, executor=None, max_workers=1):
|
||||||
TelegramClient.__init__, loop=loop
|
TelegramClient.__init__, loop=loop
|
||||||
)
|
)
|
||||||
|
|
||||||
|
event_cls = filter(None, (
|
||||||
|
getattr(getattr(events, name), 'Event', None)
|
||||||
|
for name in dir(events)
|
||||||
|
))
|
||||||
_syncify(TelegramClient, Draft, Dialog, MessageButton, ChatGetter,
|
_syncify(TelegramClient, Draft, Dialog, MessageButton, ChatGetter,
|
||||||
SenderGetter, Forward, Message, InlineResult, Conversation,
|
SenderGetter, Forward, Message, InlineResult, Conversation,
|
||||||
|
*event_cls,
|
||||||
loop=loop, thread_ident=__asyncthread.ident)
|
loop=loop, thread_ident=__asyncthread.ident)
|
||||||
_syncify_wrap(TelegramClient, "start", loop, __asyncthread.ident)
|
_syncify_wrap(TelegramClient, "start", loop, __asyncthread.ident)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user