From d3e7b24da39031850b4e73e2c44ed003486d9ada Mon Sep 17 00:00:00 2001 From: Soheab_ <33902984+Soheab@users.noreply.github.com> Date: Thu, 8 Dec 2022 20:05:38 +0100 Subject: [PATCH 01/17] Push all additions --- nextcord/enums.py | 1 + nextcord/message.py | 3 +++ nextcord/role.py | 12 ++++++++++++ nextcord/types/guild.py | 2 ++ 4 files changed, 18 insertions(+) diff --git a/nextcord/enums.py b/nextcord/enums.py index 29f292e116..c2946fe8ee 100644 --- a/nextcord/enums.py +++ b/nextcord/enums.py @@ -178,6 +178,7 @@ class MessageType(IntEnum): guild_invite_reminder = 22 context_menu_command = 23 auto_moderation_action = 24 + role_subscription_purchase = 25 class VoiceRegion(StrEnum): diff --git a/nextcord/message.py b/nextcord/message.py index ad3bbcde8d..191f0d18eb 100644 --- a/nextcord/message.py +++ b/nextcord/message.py @@ -1269,6 +1269,9 @@ def system_content(self): if self.type is MessageType.guild_invite_reminder: return "Wondering who to invite?\nStart by inviting anyone who can help you build the server!" + if self.type is MessageType.role_subscription_purchase: + ... # TODO: implement this + async def delete(self, *, delay: Optional[float] = None) -> None: """|coro| diff --git a/nextcord/role.py b/nextcord/role.py index 280725bfa1..3d36e08411 100644 --- a/nextcord/role.py +++ b/nextcord/role.py @@ -47,22 +47,30 @@ class RoleTags: The bot's user ID that manages this role. integration_id: Optional[:class:`int`] The integration ID that manages the role. + subscription_listing_id: Optional[:class:`int`] + The id of this role's subscription sku and listing """ __slots__ = ( "bot_id", "integration_id", + "subscription_listing_id", "_premium_subscriber", + "_available_for_purchase", ) def __init__(self, data: RoleTagPayload): self.bot_id: Optional[int] = get_as_snowflake(data, "bot_id") self.integration_id: Optional[int] = get_as_snowflake(data, "integration_id") + self.subscription_listing_id: Optional[int] = get_as_snowflake( + data, "subscription_listing_id" + ) # NOTE: The API returns "null" for this if it's valid, which corresponds to None. # This is different from other fields where "null" means "not there". # So in this case, a value of None is the same as True. # 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) def is_bot_managed(self) -> bool: """:class:`bool`: Whether the role is associated with a bot.""" @@ -72,6 +80,10 @@ def is_premium_subscriber(self) -> bool: """:class:`bool`: Whether the role is the premium subscriber, AKA "boost", role for the guild.""" return self._premium_subscriber is None + def is_available_for_purchase(self) -> bool: + """:class:`bool`: Whether the role is available for purchase.""" + return self._available_for_purchase is None + def is_integration(self) -> bool: """:class:`bool`: Whether the role is managed by an integration.""" return self.integration_id is not None diff --git a/nextcord/types/guild.py b/nextcord/types/guild.py index b1d67a0ee5..a223239dff 100644 --- a/nextcord/types/guild.py +++ b/nextcord/types/guild.py @@ -58,6 +58,8 @@ class UnavailableGuild(TypedDict): "VERIFIED", "VIP_REGIONS", "WELCOME_SCREEN_ENABLED", + "ROLE_SUBSCRIPTIONS_AVAILABLE_FOR_PURCHASE", + "ROLE_SUBSCRIPTIONS_ENABLED", ] From 1c36fd31c2744d6f946ef7d64d9f4c79c0bff66f Mon Sep 17 00:00:00 2001 From: Soheab_ <33902984+Soheab@users.noreply.github.com> Date: Thu, 8 Dec 2022 20:28:13 +0100 Subject: [PATCH 02/17] Add to typings too --- nextcord/types/role.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nextcord/types/role.py b/nextcord/types/role.py index 3a6760915f..5f8929f5b4 100644 --- a/nextcord/types/role.py +++ b/nextcord/types/role.py @@ -27,3 +27,5 @@ class RoleTags(TypedDict, total=False): bot_id: Snowflake integration_id: Snowflake premium_subscriber: None + subscription_listing_id: Snowflake + available_for_purchase: None From 073b25d4bce6450bfa6af8754578e1d30b38cfd0 Mon Sep 17 00:00:00 2001 From: Soheab_ <33902984+Soheab@users.noreply.github.com> Date: Thu, 8 Dec 2022 20:56:58 +0100 Subject: [PATCH 03/17] add versionadded --- docs/api.rst | 6 ++++++ nextcord/role.py | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/api.rst b/docs/api.rst index 03ca66390e..11d0f9f0ed 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -1440,6 +1440,12 @@ of :class:`enum.Enum`. .. versionadded:: 2.1 + .. attribute:: role_subscription_purchase + + The system message denoting that a role subscription was purchased. + + .. versionadded:: 2.4 + .. class:: UserFlags Represents Discord User flags. diff --git a/nextcord/role.py b/nextcord/role.py index 3d36e08411..201bfd9d8d 100644 --- a/nextcord/role.py +++ b/nextcord/role.py @@ -49,6 +49,8 @@ class RoleTags: The integration ID that manages the role. subscription_listing_id: Optional[:class:`int`] The id of this role's subscription sku and listing + + .. versionadded:: 2.4 """ __slots__ = ( @@ -81,7 +83,10 @@ def is_premium_subscriber(self) -> bool: return self._premium_subscriber is None def is_available_for_purchase(self) -> bool: - """:class:`bool`: Whether the role is available for purchase.""" + """:class:`bool`: Whether the role is available for purchase. + + .. versionadded:: 2.4 + """ return self._available_for_purchase is None def is_integration(self) -> bool: From ec635486213535e47210f8883fc219ebe00befc0 Mon Sep 17 00:00:00 2001 From: Soheab_ <33902984+Soheab@users.noreply.github.com> Date: Sun, 22 Jan 2023 18:22:57 +0100 Subject: [PATCH 04/17] add missed guild features --- nextcord/guild.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nextcord/guild.py b/nextcord/guild.py index 4d808205d4..f47cb9b2da 100644 --- a/nextcord/guild.py +++ b/nextcord/guild.py @@ -223,6 +223,8 @@ class Guild(Hashable): - ``VERIFIED``: Guild is a verified server. - ``VIP_REGIONS``: Guild has VIP voice regions. - ``WELCOME_SCREEN_ENABLED``: Guild has enabled the welcome screen. + - ``ROLE_SUBSCRIPTIONS_ENABLED``: Guild has enabled role subscriptions. + - ``ROLE_SUBSCRIPTIONS_AVAILABLE_FOR_PURCHASE``: Guild has role subscriptions that can be purchased. premium_tier: :class:`int` The premium tier for this guild. Corresponds to "Boost Level" in the official UI. From f2b1bd752b3d48355609c66f51cf64dc3092ed63 Mon Sep 17 00:00:00 2001 From: Soheab_ <33902984+Soheab@users.noreply.github.com> Date: Sun, 22 Jan 2023 18:58:47 +0100 Subject: [PATCH 05/17] add missing system channel flags --- nextcord/flags.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/nextcord/flags.py b/nextcord/flags.py index 356eb7e5ba..bacfa5188e 100644 --- a/nextcord/flags.py +++ b/nextcord/flags.py @@ -219,6 +219,22 @@ def join_notification_replies(self): """ return 8 + @flag_value + def role_subscription_purchase_notifications(self): + """:class:`bool`: Returns ``True`` if the system channel is used for role subscription purchase notifications. + + .. versionadded:: 2.4 + """ + return 16 + + @flag_value + def role_subscription_purchase_notification_replies(self): + """:class:`bool`: Returns ``True`` if the button to reply with a sticker to role subscription purchase notifications is shown. + + .. versionadded:: 2.4 + """ + return 32 + @fill_with_flags() class ChannelFlags(BaseFlags): From 06513665202fd18e5a32a5d6c317b3cc8a19c636 Mon Sep 17 00:00:00 2001 From: Soheab_ <33902984+Soheab@users.noreply.github.com> Date: Sun, 22 Jan 2023 18:59:09 +0100 Subject: [PATCH 06/17] add missing IntegrationType --- nextcord/types/integration.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nextcord/types/integration.py b/nextcord/types/integration.py index f3f7fe4a6c..2d1eac0a5f 100644 --- a/nextcord/types/integration.py +++ b/nextcord/types/integration.py @@ -34,7 +34,7 @@ class PartialIntegration(TypedDict): account: IntegrationAccount -IntegrationType = Literal["twitch", "youtube", "discord"] +IntegrationType = Literal["twitch", "youtube", "discord", "guild_subscription"] class BaseIntegration(PartialIntegration): From 1e15986e7003db5eafe7fc3cff3daeb1dcf878cb Mon Sep 17 00:00:00 2001 From: Soheab_ <33902984+Soheab@users.noreply.github.com> Date: Sun, 22 Jan 2023 19:07:57 +0100 Subject: [PATCH 07/17] add support for role_subscription_data field on Message --- nextcord/message.py | 45 +++++++++++++++++++++++++++++++++++++++ nextcord/types/message.py | 8 +++++++ 2 files changed, 53 insertions(+) diff --git a/nextcord/message.py b/nextcord/message.py index 191f0d18eb..132b3bf1ea 100644 --- a/nextcord/message.py +++ b/nextcord/message.py @@ -57,6 +57,7 @@ MessageApplication as MessageApplicationPayload, MessageReference as MessageReferencePayload, Reaction as ReactionPayload, + RoleSubscriptionData as RoleSubscriptionDataPayload, ) from .types.threads import Thread as ThreadPayload, ThreadArchiveDuration from .types.user import User as UserPayload @@ -72,6 +73,7 @@ "MessageReference", "DeletedReferencedMessage", "MessageInteraction", + "MessageRoleSubscription", ) @@ -606,6 +608,39 @@ def created_at(self) -> datetime.datetime: return utils.snowflake_time(self.id) +class MessageRoleSubscription: + """Represents a message's role subscription information. + + This is accessed through the :attr:`Message.role_subscription` attribute if the :attr:`Message.type` is :attr:`MessageType.role_subscription_purchase`. + + .. versionadded:: 2.4 + + Attributes + ----------- + role_subscription_listing_id: :class:`int` + The ID of the SKU and listing that the user is subscribed to. + tier_name: :class:`str` + The name of the tier that the user is subscribed to. + total_months_subscribed: :class:`int` + The cumulative number of months that the user has been subscribed for. + is_renewal: :class:`bool` + Whether this notification is for a renewal rather than a new purchase. + """ + + __slots__ = ( + "role_subscription_listing_id", + "tier_name", + "total_months_subscribed", + "is_renewal", + ) + + def __init__(self, data: RoleSubscriptionDataPayload) -> None: + self.role_subscription_listing_id: int = int(data["role_subscription_listing_id"]) + self.tier_name: str = data["tier_name"] + self.total_months_subscribed: int = data["total_months_subscribed"] + self.is_renewal: bool = data["is_renewal"] + + @flatten_handlers class Message(Hashable): r"""Represents a message from Discord. @@ -723,6 +758,10 @@ class Message(Hashable): The guild that the message belongs to, if applicable. interaction: Optional[:class:`MessageInteraction`] The interaction data of a message, if applicable. + role_subscription: Optional[:class:`MessageRoleSubscription`] + The role subscription data of a message, if applicable. + + .. versionadded:: 2.4 """ __slots__ = ( @@ -757,6 +796,7 @@ class Message(Hashable): "stickers", "components", "guild", + "role_subscription", ) if TYPE_CHECKING: @@ -852,6 +892,11 @@ def __init__( if "interaction" in data else None ) + self.role_subscription: Optional[MessageRoleSubscription] = ( + MessageRoleSubscription(data=data["role_subscription_data"]) + if "role_subscription_data" in data + else None + ) def __repr__(self) -> str: name = self.__class__.__name__ diff --git a/nextcord/types/message.py b/nextcord/types/message.py index cdc672fa08..c736e83899 100644 --- a/nextcord/types/message.py +++ b/nextcord/types/message.py @@ -66,6 +66,13 @@ class MessageReference(TypedDict, total=False): fail_if_not_exists: bool +class RoleSubscriptionData(TypedDict): + role_subscription_listing_id: Snowflake + tier_name: str + total_months_subscribed: int + is_renewal: bool + + MessageType = Literal[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 18, 19, 20, 21] @@ -99,6 +106,7 @@ class Message(TypedDict): referenced_message: NotRequired[Optional[Message]] interaction: NotRequired[MessageInteraction] components: NotRequired[List[Component]] + role_subscription_data: NotRequired[RoleSubscriptionData] AllowedMentionType = Literal["roles", "users", "everyone"] From bca1c35d01cc298d63d8f9abf9c07079d0b804b1 Mon Sep 17 00:00:00 2001 From: Soheab_ <33902984+Soheab@users.noreply.github.com> Date: Sun, 22 Jan 2023 19:14:05 +0100 Subject: [PATCH 08/17] fill in system message for purchase --- nextcord/message.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/nextcord/message.py b/nextcord/message.py index 132b3bf1ea..f5297c294f 100644 --- a/nextcord/message.py +++ b/nextcord/message.py @@ -1314,8 +1314,18 @@ def system_content(self): if self.type is MessageType.guild_invite_reminder: return "Wondering who to invite?\nStart by inviting anyone who can help you build the server!" - if self.type is MessageType.role_subscription_purchase: - ... # TODO: implement this + if ( + self.type is MessageType.role_subscription_purchase + and self.role_subscription is not None + ): + tier_name = self.role_subscription.tier_name + total_months_subscribed = self.role_subscription.total_months_subscribed + months = f"{total_months_subscribed} month{'s' if total_months_subscribed != 1 else ''}" + if self.role_subscription.is_renewal: + # TODO: figure this out. + return "" + + return f"{self.author.name} joined {tier_name} and has been a subscriber of {self.guild} for {months}" async def delete(self, *, delay: Optional[float] = None) -> None: """|coro| From 2852357fa6e0be8a056a29318f3e158afbd4220c Mon Sep 17 00:00:00 2001 From: Soheab_ <33902984+Soheab@users.noreply.github.com> Date: Sun, 22 Jan 2023 19:18:26 +0100 Subject: [PATCH 09/17] add missing MessageTypes --- nextcord/types/message.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nextcord/types/message.py b/nextcord/types/message.py index c736e83899..08aca5fc85 100644 --- a/nextcord/types/message.py +++ b/nextcord/types/message.py @@ -73,7 +73,9 @@ class RoleSubscriptionData(TypedDict): is_renewal: bool -MessageType = Literal[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 18, 19, 20, 21] +MessageType = Literal[ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 18, 19, 20, 21, 22, 23, 24, 25 +] class Message(TypedDict): From 84c33f85ce99c812bb947a74bac32f06b8d81597 Mon Sep 17 00:00:00 2001 From: Soheab <33902984+Soheab@users.noreply.github.com> Date: Mon, 18 Sep 2023 14:50:31 +0200 Subject: [PATCH 10/17] Revert doc change for subscription_listing_id --- nextcord/role.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nextcord/role.py b/nextcord/role.py index d3349defb6..1141d43d8a 100644 --- a/nextcord/role.py +++ b/nextcord/role.py @@ -49,7 +49,7 @@ class RoleTags: integration_id: Optional[:class:`int`] The integration ID that manages the role. subscription_listing_id: Optional[:class:`int`] - The id of this role's subscription sku and listing + The ID of the subscription listing that manages the role. .. versionadded:: 2.4 """ From 8c41780be1f4a663dfc0fc5a4b7bec72357df798 Mon Sep 17 00:00:00 2001 From: Soheab <33902984+Soheab@users.noreply.github.com> Date: Mon, 18 Sep 2023 14:52:51 +0200 Subject: [PATCH 11/17] fix: correct system_content for role subs Co-Authored-By: teaishealthy <76410798+teaishealthy@users.noreply.github.com> --- nextcord/message.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/nextcord/message.py b/nextcord/message.py index 3005835fb1..030b7e0a5e 100644 --- a/nextcord/message.py +++ b/nextcord/message.py @@ -1335,10 +1335,9 @@ def system_content(self): total_months_subscribed = self.role_subscription.total_months_subscribed months = f"{total_months_subscribed} month{'s' if total_months_subscribed != 1 else ''}" if self.role_subscription.is_renewal: - # TODO: figure this out. - return "" + return f"{self.author.name} renewed {tier_name} and has been a subscriber of {self.guild} for {months}!" - return f"{self.author.name} joined {tier_name} and has been a subscriber of {self.guild} for {months}" + return f"{self.author.name} joined {tier_name} and has been a subscriber of {self.guild} for {months}!" async def delete(self, *, delay: Optional[float] = None) -> None: """|coro| From 01bc28f8521e097a50fb2adc49c6e0da4d7b7cc5 Mon Sep 17 00:00:00 2001 From: Soheab <33902984+Soheab@users.noreply.github.com> Date: Mon, 18 Sep 2023 14:56:41 +0200 Subject: [PATCH 12/17] docs: versionadded to 2.6 --- docs/api.rst | 2 +- nextcord/flags.py | 4 ++-- nextcord/message.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/api.rst b/docs/api.rst index 7270da209c..4d2b22ce7e 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -1499,7 +1499,7 @@ of :class:`enum.Enum`. The system message denoting that a role subscription was purchased. - .. versionadded:: 2.4 + .. versionadded:: 2.6 .. class:: UserFlags diff --git a/nextcord/flags.py b/nextcord/flags.py index 307baf3e1a..9973cbd340 100644 --- a/nextcord/flags.py +++ b/nextcord/flags.py @@ -225,7 +225,7 @@ def join_notification_replies(self) -> int: def role_subscription_purchase_notifications(self) -> int: """:class:`bool`: Returns ``True`` if the system channel is used for role subscription purchase notifications. - .. versionadded:: 2.4 + .. versionadded:: 2.6 """ return 16 @@ -233,7 +233,7 @@ def role_subscription_purchase_notifications(self) -> int: def role_subscription_purchase_notification_replies(self) -> int: """:class:`bool`: Returns ``True`` if the button to reply with a sticker to role subscription purchase notifications is shown. - .. versionadded:: 2.4 + .. versionadded:: 2.6 """ return 32 diff --git a/nextcord/message.py b/nextcord/message.py index 030b7e0a5e..ccbab6a2c5 100644 --- a/nextcord/message.py +++ b/nextcord/message.py @@ -626,7 +626,7 @@ class MessageRoleSubscription: This is accessed through the :attr:`Message.role_subscription` attribute if the :attr:`Message.type` is :attr:`MessageType.role_subscription_purchase`. - .. versionadded:: 2.4 + .. versionadded:: 2.6 Attributes ----------- @@ -774,7 +774,7 @@ class Message(Hashable): role_subscription: Optional[:class:`MessageRoleSubscription`] The role subscription data of a message, if applicable. - .. versionadded:: 2.4 + .. versionadded:: 2.6 """ __slots__ = ( From c3547db7c22af3caece6fd635ca026cabc97530b Mon Sep 17 00:00:00 2001 From: Soheab <33902984+Soheab@users.noreply.github.com> Date: Mon, 18 Sep 2023 14:57:25 +0200 Subject: [PATCH 13/17] fix: remove duplicated method --- nextcord/role.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/nextcord/role.py b/nextcord/role.py index 1141d43d8a..e6c6d6c6f0 100644 --- a/nextcord/role.py +++ b/nextcord/role.py @@ -89,13 +89,6 @@ def is_premium_subscriber(self) -> bool: """:class:`bool`: Whether the role is the premium subscriber, AKA "boost", role for the guild.""" return self._premium_subscriber is None - def is_available_for_purchase(self) -> bool: - """:class:`bool`: Whether the role is available for purchase. - - .. versionadded:: 2.4 - """ - return self._available_for_purchase is None - def is_integration(self) -> bool: """:class:`bool`: Whether the role is managed by an integration.""" return self.integration_id is not None From 5b3bb1f659527e1d78bd9b75ec33ca715d594736 Mon Sep 17 00:00:00 2001 From: Soheab <33902984+Soheab@users.noreply.github.com> Date: Mon, 18 Sep 2023 15:04:42 +0200 Subject: [PATCH 14/17] refactor: use ``in`` over ``dict.get`` for some attrs in RoleTags Co-Authored-By: teaishealthy <76410798+teaishealthy@users.noreply.github.com> --- nextcord/role.py | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/nextcord/role.py b/nextcord/role.py index e6c6d6c6f0..23a403407f 100644 --- a/nextcord/role.py +++ b/nextcord/role.py @@ -51,6 +51,18 @@ class RoleTags: subscription_listing_id: Optional[:class:`int`] The ID of the subscription listing that manages the role. + .. versionadded:: 2.4 + premium_subscriber: :class:`bool` + Whether the role is the premium subscriber, AKA "boost", role for the guild. + + versionadded:: 2.4 + available_for_purchase: :class:`bool` + Whether the role is available for purchase. + + .. versionadded:: 2.4 + guild_connections: :class:`bool` + Whether the role is a guild's linked role. + .. versionadded:: 2.4 """ @@ -58,10 +70,9 @@ class RoleTags: "bot_id", "integration_id", "subscription_listing_id", - "_premium_subscriber", - "subscription_listing_id", - "_available_for_purchase", - "_guild_connections", + "premium_subscriber", + "available_for_purchase", + "guild_connections", ) def __init__(self, data: RoleTagPayload) -> None: @@ -74,12 +85,12 @@ def __init__(self, data: RoleTagPayload) -> None: # This is different from other fields where "null" means "not there". # So in this case, a value of None is the same as True. # Which means we would need a different sentinel. - self._premium_subscriber: Optional[Any] = data.get("premium_subscriber", MISSING) self.subscription_listing_id: Optional[int] = get_as_snowflake( data, "subscription_listing_id" ) - self._available_for_purchase: Optional[Any] = data.get("available_for_purchase", MISSING) - self._guild_connections: Optional[Any] = data.get("guild_connections", MISSING) + self.guild_connections: bool = "guild_connections" in data + self.premium_subscriber: bool = "premium_subscriber" in data + self.available_for_purchase: bool = "available_for_purchase" in data def is_bot_managed(self) -> bool: """:class:`bool`: Whether the role is associated with a bot.""" @@ -87,7 +98,7 @@ def is_bot_managed(self) -> bool: def is_premium_subscriber(self) -> bool: """:class:`bool`: Whether the role is the premium subscriber, AKA "boost", role for the guild.""" - return self._premium_subscriber is None + return self.premium_subscriber def is_integration(self) -> bool: """:class:`bool`: Whether the role is managed by an integration.""" @@ -98,14 +109,14 @@ def is_available_for_purchase(self) -> bool: .. versionadded:: 2.4 """ - return self._available_for_purchase is None + return self.available_for_purchase def has_guild_connections(self) -> bool: """:class:`bool`: Whether the role is a guild's linked role. .. versionadded:: 2.4 """ - return self._guild_connections is None + return self.guild_connections def __repr__(self) -> str: return ( From b42f2127e26b3058f084b44ee72a649b8161df75 Mon Sep 17 00:00:00 2001 From: Soheab <33902984+Soheab@users.noreply.github.com> Date: Mon, 18 Sep 2023 15:07:49 +0200 Subject: [PATCH 15/17] fix: remove duplicated attribute for RoleTags --- nextcord/role.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/nextcord/role.py b/nextcord/role.py index 23a403407f..f2a7ef5464 100644 --- a/nextcord/role.py +++ b/nextcord/role.py @@ -78,9 +78,6 @@ class RoleTags: def __init__(self, data: RoleTagPayload) -> None: self.bot_id: Optional[int] = get_as_snowflake(data, "bot_id") self.integration_id: Optional[int] = get_as_snowflake(data, "integration_id") - self.subscription_listing_id: Optional[int] = get_as_snowflake( - data, "subscription_listing_id" - ) # NOTE: The API returns "null" for this if it's valid, which corresponds to None. # This is different from other fields where "null" means "not there". # So in this case, a value of None is the same as True. From 008037eaf7a2fca6599c208db4daf67dcf49970e Mon Sep 17 00:00:00 2001 From: Soheab_ <33902984+Soheab@users.noreply.github.com> Date: Wed, 20 Sep 2023 07:26:38 +0200 Subject: [PATCH 16/17] docs: fix underline too long Co-authored-by: Oliver Wilkes --- nextcord/message.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nextcord/message.py b/nextcord/message.py index ccbab6a2c5..97efc27d92 100644 --- a/nextcord/message.py +++ b/nextcord/message.py @@ -629,7 +629,7 @@ class MessageRoleSubscription: .. versionadded:: 2.6 Attributes - ----------- + ---------- role_subscription_listing_id: :class:`int` The ID of the SKU and listing that the user is subscribed to. tier_name: :class:`str` From 7ca2067bca8fe55bae5e9bfafb90e1740913ac4d Mon Sep 17 00:00:00 2001 From: Oliver Wilkes Date: Sat, 23 Mar 2024 19:25:05 +0000 Subject: [PATCH 17/17] docs: update versionadded to 3.0 --- docs/api.rst | 2 +- nextcord/message.py | 2 +- nextcord/role.py | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/api.rst b/docs/api.rst index 318d126667..41370f2bfb 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -1520,7 +1520,7 @@ of :class:`enum.Enum`. The system message denoting that a role subscription was purchased. - .. versionadded:: 2.6 + .. versionadded:: 3.0 .. class:: UserFlags diff --git a/nextcord/message.py b/nextcord/message.py index 9b6e82c7f5..a079866343 100644 --- a/nextcord/message.py +++ b/nextcord/message.py @@ -626,7 +626,7 @@ class MessageRoleSubscription: This is accessed through the :attr:`Message.role_subscription` attribute if the :attr:`Message.type` is :attr:`MessageType.role_subscription_purchase`. - .. versionadded:: 2.6 + .. versionadded:: 3.0 Attributes ---------- diff --git a/nextcord/role.py b/nextcord/role.py index f2a7ef5464..dff5b89754 100644 --- a/nextcord/role.py +++ b/nextcord/role.py @@ -51,19 +51,19 @@ class RoleTags: subscription_listing_id: Optional[:class:`int`] The ID of the subscription listing that manages the role. - .. versionadded:: 2.4 + .. versionadded:: 3.0 premium_subscriber: :class:`bool` Whether the role is the premium subscriber, AKA "boost", role for the guild. - versionadded:: 2.4 + versionadded:: 3.0 available_for_purchase: :class:`bool` Whether the role is available for purchase. - .. versionadded:: 2.4 + .. versionadded:: 3.0 guild_connections: :class:`bool` Whether the role is a guild's linked role. - .. versionadded:: 2.4 + .. versionadded:: 3.0 """ __slots__ = (