mirror of
https://github.com/Rapptz/discord.py.git
synced 2026-11-20 13:29:03 +00:00
Add User.mentioned_in helper to check if a message mentions you.
This commit is contained in:
1 parent
3758c0aa83
commit
e2bfa90eef
2 files changed
+32
-2
No files matched your search
@@ -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
|
||||
Reference in new issue
Block a user