diff options
Diffstat (limited to 'discord/context_managers.py')
| -rw-r--r-- | discord/context_managers.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/discord/context_managers.py b/discord/context_managers.py index 5fbf0344..83398f13 100644 --- a/discord/context_managers.py +++ b/discord/context_managers.py @@ -29,16 +29,17 @@ import asyncio from .compat import create_task class Typing: - def __init__(self, channel): - http = channel._state.http - self.loop = http.loop - self.channel = channel - self.typing = http.send_typing + def __init__(self, messageable): + self.loop = messageable._state.loop + self.messageable = messageable @asyncio.coroutine def do_typing(self): + channel = yield from self.messageable._get_channel() + typing = channel._state.http.send_typing + while True: - yield from self.typing(self.channel.id) + yield from typing(channel.id) yield from asyncio.sleep(5) def __enter__(self): |