aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2017-01-03 20:24:42 -0500
committerRapptz <[email protected]>2017-01-03 20:24:42 -0500
commit94655c77c0d681f2ed1b4dbff982adce1718970b (patch)
treead4e8d3ded77f6a7c987c3dff00c28b862bb108f
parentFix NameError when dealing with permission resolution. (diff)
downloaddiscord.py-94655c77c0d681f2ed1b4dbff982adce1718970b.tar.xz
discord.py-94655c77c0d681f2ed1b4dbff982adce1718970b.zip
Fix Messageable.typing context manager.
-rw-r--r--discord/abc.py3
-rw-r--r--discord/context_managers.py13
2 files changed, 8 insertions, 8 deletions
diff --git a/discord/abc.py b/discord/abc.py
index 7814772a..5711ef70 100644
--- a/discord/abc.py
+++ b/discord/abc.py
@@ -592,8 +592,7 @@ class Messageable(metaclass=abc.ABCMeta):
await channel.send_message('done!')
"""
- channel = yield from self._get_channel()
- return Typing(channel)
+ return Typing(self)
@asyncio.coroutine
def get_message(self, id):
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):