From 2de90fbecfe25c86e4d4c20baece85ad1a602e1e Mon Sep 17 00:00:00 2001 From: Rapptz Date: Sat, 21 Dec 2019 07:39:33 -0500 Subject: [PATCH] Add User.system and MessageFlags.urgent --- discord/flags.py | 8 ++++++++ discord/user.py | 7 ++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/discord/flags.py b/discord/flags.py index dc89c46d1..864ed915c 100644 --- a/discord/flags.py +++ b/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 diff --git a/discord/user.py b/discord/user.py index f65b8d266..b6f59c51b 100644 --- a/discord/user.py +++ b/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__',)