mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-05 09:26:10 +00:00
Drop support for Python 3.4 and make minimum version 3.5.2.
This commit is contained in:
@ -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()
|
||||
|
Reference in New Issue
Block a user