mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-06-07 12:18:59 +00:00
Add support for 'linked role' role tag
This commit is contained in:
parent
8e52db1f1b
commit
48ef01204c
@ -77,6 +77,7 @@ class RoleTags:
|
||||
'_premium_subscriber',
|
||||
'_available_for_purchase',
|
||||
'subscription_listing_id',
|
||||
'_guild_connections',
|
||||
)
|
||||
|
||||
def __init__(self, data: RoleTagPayload):
|
||||
@ -90,6 +91,7 @@ class RoleTags:
|
||||
# Which means we would need a different sentinel.
|
||||
self._premium_subscriber: Optional[Any] = data.get('premium_subscriber', MISSING)
|
||||
self._available_for_purchase: Optional[Any] = data.get('available_for_purchase', MISSING)
|
||||
self._guild_connections: Optional[Any] = data.get('guild_connections', MISSING)
|
||||
|
||||
def is_bot_managed(self) -> bool:
|
||||
""":class:`bool`: Whether the role is associated with a bot."""
|
||||
@ -110,6 +112,13 @@ class RoleTags:
|
||||
"""
|
||||
return self._available_for_purchase is None
|
||||
|
||||
def is_guild_connection(self) -> bool:
|
||||
""":class:`bool`: Whether the role is a guild's linked role.
|
||||
|
||||
.. versionadded:: 2.2
|
||||
"""
|
||||
return self._guild_connections is None
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return (
|
||||
f'<RoleTags bot_id={self.bot_id} integration_id={self.integration_id} '
|
||||
|
@ -50,3 +50,4 @@ class RoleTags(TypedDict, total=False):
|
||||
subscription_listing_id: Snowflake
|
||||
premium_subscriber: None
|
||||
available_for_purchase: None
|
||||
guild_connections: None
|
||||
|
Loading…
x
Reference in New Issue
Block a user