Browse Source

Add User.system and MessageFlags.urgent

pull/2484/head
Rapptz 5 years ago
parent
commit
2de90fbecf
  1. 8
      discord/flags.py
  2. 7
      discord/user.py

8
discord/flags.py

@ -215,3 +215,11 @@ class MessageFlags(BaseFlags):
def source_message_deleted(self):
""":class:`bool`: Returns ``True`` if the source message for this crosspost has been deleted."""
return 8
@flag_value
def urgent(self):
""":class:`bool`: Returns ``True`` if the source message is an urgent message.
An urgent message is one sent by Discord Trust and Safety.
"""
return 16

7
discord/user.py

@ -74,7 +74,7 @@ class Profile(namedtuple('Profile', 'flags user mutual_guilds connected_accounts
_BaseUser = discord.abc.User
class BaseUser(_BaseUser):
__slots__ = ('name', 'id', 'discriminator', 'avatar', 'bot', '_state')
__slots__ = ('name', 'id', 'discriminator', 'avatar', 'bot', 'system', '_state')
def __init__(self, *, state, data):
self._state = state
@ -98,6 +98,7 @@ class BaseUser(_BaseUser):
self.discriminator = data['discriminator']
self.avatar = data['avatar']
self.bot = data.get('bot', False)
self.system = data.get('system', False)
@classmethod
def _copy(cls, user):
@ -290,6 +291,8 @@ class ClientUser(BaseUser):
The avatar hash the user has. Could be None.
bot: :class:`bool`
Specifies if the user is a bot account.
system: :class:`bool`
Specifies if the user is a system user (i.e. represents Discord officially).
verified: :class:`bool`
Specifies if the user is a verified account.
email: Optional[:class:`str`]
@ -658,6 +661,8 @@ class User(BaseUser, discord.abc.Messageable):
The avatar hash the user has. Could be None.
bot: :class:`bool`
Specifies if the user is a bot account.
system: :class:`bool`
Specifies if the user is a system user (i.e. represents Discord officially).
"""
__slots__ = BaseUser.__slots__ + ('__weakref__',)

Loading…
Cancel
Save