aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2017-02-28 00:47:37 -0500
committerRapptz <[email protected]>2017-02-28 00:47:37 -0500
commit8daf411c727d4bf23beba569cd054d8f69df7de5 (patch)
tree6c13de62aae4404f271a425b4fea7d4c2e8310ec
parentAdd User.is_blocked and User.is_friend shortcut methods. (diff)
downloaddiscord.py-8daf411c727d4bf23beba569cd054d8f69df7de5.tar.xz
discord.py-8daf411c727d4bf23beba569cd054d8f69df7de5.zip
Add Messageable.ack
-rw-r--r--discord/abc.py22
-rw-r--r--discord/http.py6
2 files changed, 28 insertions, 0 deletions
diff --git a/discord/abc.py b/discord/abc.py
index 1ad6fb50..d0ddd42d 100644
--- a/discord/abc.py
+++ b/discord/abc.py
@@ -776,3 +776,25 @@ class Messageable(metaclass=abc.ABCMeta):
counter += 1
"""
return HistoryIterator(self, limit=limit, before=before, after=after, around=around, reverse=reverse)
+
+ @asyncio.coroutine
+ def ack(self):
+ """|coro|
+
+ Marks this channel as read.
+
+ The user must not be a bot user.
+
+ Raises
+ -------
+ HTTPException
+ Acking failed.
+ ClientException
+ You must not be a bot user.
+ """
+
+ state = self._state
+ if state.is_bot:
+ raise ClientException('Must not be a bot account to ack messages.')
+ channel = yield from self._get_channel()
+ yield from state.http.ack_channel(channel.id)
diff --git a/discord/http.py b/discord/http.py
index 29f4fdfc..3b80b128 100644
--- a/discord/http.py
+++ b/discord/http.py
@@ -329,6 +329,12 @@ class HTTPClient:
data = yield from self.request(r, json={'token': self._ack_token})
self._ack_token = data['token']
+ @asyncio.coroutine
+ def ack_channel(self, channel_id):
+ r = Route('POST', '/channels/{channel_id}/ack', channel_id=channel_id)
+ data = yield from self.request(r, json={'token': self._ack_token})
+ self._ack_token = data['token']
+
def ack_guild(self, guild_id):
return self.request(Route('POST', '/guilds/{guild_id}/ack', guild_id=guild_id))