From 48ef01204cbc4628659e682cd6bcfc4e052b0ab7 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Tue, 10 Jan 2023 18:13:01 -0500 Subject: [PATCH] Add support for 'linked role' role tag --- discord/role.py | 9 +++++++++ discord/types/role.py | 1 + 2 files changed, 10 insertions(+) diff --git a/discord/role.py b/discord/role.py index f2a3c2c4d..643f918fc 100644 --- a/discord/role.py +++ b/discord/role.py @@ -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'