Add User.system and MessageFlags.urgent

This commit is contained in:
Rapptz 2019-12-21 07:39:33 -05:00
parent f7687e0a68
commit 2de90fbecf
2 changed files with 14 additions and 1 deletions

View File

@ -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

View File

@ -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__',)