mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-05-15 18:29:52 +00:00
Fix Messageable.typing context manager.
This commit is contained in:
parent
d086b5421d
commit
94655c77c0
@ -592,8 +592,7 @@ class Messageable(metaclass=abc.ABCMeta):
|
|||||||
await channel.send_message('done!')
|
await channel.send_message('done!')
|
||||||
|
|
||||||
"""
|
"""
|
||||||
channel = yield from self._get_channel()
|
return Typing(self)
|
||||||
return Typing(channel)
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def get_message(self, id):
|
def get_message(self, id):
|
||||||
|
@ -29,16 +29,17 @@ import asyncio
|
|||||||
from .compat import create_task
|
from .compat import create_task
|
||||||
|
|
||||||
class Typing:
|
class Typing:
|
||||||
def __init__(self, channel):
|
def __init__(self, messageable):
|
||||||
http = channel._state.http
|
self.loop = messageable._state.loop
|
||||||
self.loop = http.loop
|
self.messageable = messageable
|
||||||
self.channel = channel
|
|
||||||
self.typing = http.send_typing
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def do_typing(self):
|
def do_typing(self):
|
||||||
|
channel = yield from self.messageable._get_channel()
|
||||||
|
typing = channel._state.http.send_typing
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
yield from self.typing(self.channel.id)
|
yield from typing(channel.id)
|
||||||
yield from asyncio.sleep(5)
|
yield from asyncio.sleep(5)
|
||||||
|
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user