aboutsummaryrefslogtreecommitdiff
path: root/discord/user.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2016-04-29 20:11:13 -0400
committerRapptz <[email protected]>2016-04-29 20:11:13 -0400
commite2bfa90eef71425af80403ba5e60c7e52c179bf9 (patch)
tree2dd7c7f3c029cf1f6eb43547f18cf2da6ffd9f7b /discord/user.py
parentMember.mention now uses nickname hint if needed. (diff)
downloaddiscord.py-e2bfa90eef71425af80403ba5e60c7e52c179bf9.tar.xz
discord.py-e2bfa90eef71425af80403ba5e60c7e52c179bf9.zip
Add User.mentioned_in helper to check if a message mentions you.
Diffstat (limited to 'discord/user.py')
-rw-r--r--discord/user.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/discord/user.py b/discord/user.py
index c05d9aa1..9dc0ded7 100644
--- a/discord/user.py
+++ b/discord/user.py
@@ -135,3 +135,19 @@ class User:
"""
return getattr(self, 'nick', None) or self.name
+ def mentioned_in(self, message):
+ """Checks if the user is mentioned in the specified message.
+
+ Parameters
+ -----------
+ message : :class:`Message`
+ The message to check if you're mentioned in.
+ """
+
+ if message.mention_everyone:
+ return True
+
+ if self in message.mentions:
+ return True
+
+ return False