aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2017-02-27 23:06:35 -0500
committerRapptz <[email protected]>2017-02-27 23:29:52 -0500
commitf7524c9919d078c4fab1e8f57174192ef94528f5 (patch)
treec3232bfe81d9ca5d65c85231d0d1fb4e6f51c830
parentAdd support for message acking. (diff)
downloaddiscord.py-f7524c9919d078c4fab1e8f57174192ef94528f5.tar.xz
discord.py-f7524c9919d078c4fab1e8f57174192ef94528f5.zip
Add User.is_blocked and User.is_friend shortcut methods.
-rw-r--r--discord/user.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/discord/user.py b/discord/user.py
index 1b8dd766..0a22c484 100644
--- a/discord/user.py
+++ b/discord/user.py
@@ -449,6 +449,20 @@ class User(BaseUser, discord.abc.Messageable):
"""Returns the :class:`Relationship` with this user if applicable, ``None`` otherwise."""
return self._state.user.get_relationship(self.id)
+ def is_friend(self):
+ """bool: Checks if the user is your friend."""
+ r = self.relationship
+ if r is None:
+ return False
+ return r.type is RelationshipType.friend
+
+ def is_blocked(self):
+ """bool: Checks if the user is blocked."""
+ r = self.relationship
+ if r is None:
+ return False
+ return r.type is RelationshipType.blocked
+
@asyncio.coroutine
def block(self):
"""|coro|