mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-06-07 20:28:38 +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',
|
'_premium_subscriber',
|
||||||
'_available_for_purchase',
|
'_available_for_purchase',
|
||||||
'subscription_listing_id',
|
'subscription_listing_id',
|
||||||
|
'_guild_connections',
|
||||||
)
|
)
|
||||||
|
|
||||||
def __init__(self, data: RoleTagPayload):
|
def __init__(self, data: RoleTagPayload):
|
||||||
@ -90,6 +91,7 @@ class RoleTags:
|
|||||||
# Which means we would need a different sentinel.
|
# Which means we would need a different sentinel.
|
||||||
self._premium_subscriber: Optional[Any] = data.get('premium_subscriber', MISSING)
|
self._premium_subscriber: Optional[Any] = data.get('premium_subscriber', MISSING)
|
||||||
self._available_for_purchase: Optional[Any] = data.get('available_for_purchase', 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:
|
def is_bot_managed(self) -> bool:
|
||||||
""":class:`bool`: Whether the role is associated with a bot."""
|
""":class:`bool`: Whether the role is associated with a bot."""
|
||||||
@ -110,6 +112,13 @@ class RoleTags:
|
|||||||
"""
|
"""
|
||||||
return self._available_for_purchase is None
|
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:
|
def __repr__(self) -> str:
|
||||||
return (
|
return (
|
||||||
f'<RoleTags bot_id={self.bot_id} integration_id={self.integration_id} '
|
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
|
subscription_listing_id: Snowflake
|
||||||
premium_subscriber: None
|
premium_subscriber: None
|
||||||
available_for_purchase: None
|
available_for_purchase: None
|
||||||
|
guild_connections: None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user