Add Conversation to the sync magic module

This commit is contained in:
Lonami Exo
2018-08-05 11:05:01 +02:00
parent 48113851a8
commit cc067b2569
2 changed files with 8 additions and 2 deletions

View File

@@ -420,6 +420,9 @@ class Conversation(ChatGetter):
except asyncio.CancelledError:
pass
def __enter__(self):
return self._client.loop.run_until_complete(self.__aenter__())
async def __aenter__(self):
self._client._conversations[self._id] = self
self._input_chat = \
@@ -439,5 +442,8 @@ class Conversation(ChatGetter):
return self
def __exit__(self, *args):
return self._client.loop.run_until_complete(self.__aexit__(*args))
async def __aexit__(self, *args):
del self._client._conversations[self._id]