aboutsummaryrefslogtreecommitdiff
path: root/discord/context_managers.py
diff options
context:
space:
mode:
Diffstat (limited to 'discord/context_managers.py')
-rw-r--r--discord/context_managers.py19
1 files changed, 8 insertions, 11 deletions
diff --git a/discord/context_managers.py b/discord/context_managers.py
index 93d292c2..94f817d4 100644
--- a/discord/context_managers.py
+++ b/discord/context_managers.py
@@ -40,18 +40,17 @@ class Typing:
self.loop = messageable._state.loop
self.messageable = messageable
- @asyncio.coroutine
- def do_typing(self):
+ async def do_typing(self):
try:
channel = self._channel
except AttributeError:
- channel = yield from self.messageable._get_channel()
+ channel = await self.messageable._get_channel()
typing = channel._state.http.send_typing
while True:
- yield from typing(channel.id)
- yield from asyncio.sleep(5)
+ await typing(channel.id)
+ await asyncio.sleep(5)
def __enter__(self):
self.task = create_task(self.do_typing(), loop=self.loop)
@@ -61,12 +60,10 @@ class Typing:
def __exit__(self, exc_type, exc, tb):
self.task.cancel()
- @asyncio.coroutine
- def __aenter__(self):
- self._channel = channel = yield from self.messageable._get_channel()
- yield from channel._state.http.send_typing(channel.id)
+ async def __aenter__(self):
+ self._channel = channel = await self.messageable._get_channel()
+ await channel._state.http.send_typing(channel.id)
return self.__enter__()
- @asyncio.coroutine
- def __aexit__(self, exc_type, exc, tb):
+ async def __aexit__(self, exc_type, exc, tb):
self.task.cancel()