@@ -144,9 +144,10 @@ class RoleType(IntEnum):
144144 GUILD_PRODUCT = 3
145145 PREMIUM_SUBSCRIPTION_BASE = 4 # Not possible to determine currently, will be INTEGRATION if it's a base subscription
146146 PREMIUM_SUBSCRIPTION_TIER = 5
147- DRAFT_PREMIUM_SUBSCRIPTION_TIER = 5
147+ DRAFT_PREMIUM_SUBSCRIPTION_TIER = 6
148148 INTEGRATION = 7
149149 CONNECTION = 8
150+ UNKNOWN = 9
150151
151152
152153class RoleTags :
@@ -180,6 +181,7 @@ class RoleTags:
180181 "_premium_subscriber" ,
181182 "_available_for_purchase" ,
182183 "_guild_connections" ,
184+ "_is_guild_product_role" ,
183185 "bot_id" ,
184186 "_data" ,
185187 "_type" ,
@@ -201,6 +203,8 @@ def __init__(self, data: RoleTagPayload):
201203 self ._available_for_purchase : bool | None = _parse_tag_bool (
202204 data , "available_for_purchase"
203205 )
206+ # here discord did things in a normal and logical way for once
207+ self ._is_guild_product_role : bool | None = data .get ("is_guild_product_role" )
204208
205209 @cached_slot_property ("_type" )
206210 def type (self ) -> RoleType :
@@ -214,28 +218,29 @@ def type(self) -> RoleType:
214218 return RoleType .CONNECTION
215219
216220 # Paid roles
217- if self ._guild_connections is False :
218- if self . _premium_subscriber is False :
219- return RoleType . GUILD_PRODUCT
220-
221- if self ._premium_subscriber is True :
222- return RoleType .BOOSTER
223-
224- # subscription roles
225- if self . integration_id is not None :
226- if (
227- self ._premium_subscriber is None
228- and self .subscription_listing_id is not None
229- ):
230- if self ._available_for_purchase is True :
231- return RoleType .PREMIUM_SUBSCRIPTION_TIER
232- return RoleType .DRAFT_PREMIUM_SUBSCRIPTION_TIER
221+ if self ._is_guild_product_role is True :
222+ return RoleType . GUILD_PRODUCT
223+
224+ # Booster role
225+ if self ._premium_subscriber is True :
226+ return RoleType .BOOSTER
227+
228+ # subscription roles
229+ if (
230+ self . integration_id is not None
231+ and self ._premium_subscriber is None
232+ and self .subscription_listing_id is not None
233+ ):
234+ if self ._available_for_purchase is True :
235+ return RoleType .PREMIUM_SUBSCRIPTION_TIER
236+ return RoleType .DRAFT_PREMIUM_SUBSCRIPTION_TIER
233237
234238 # integration role (Twitch/YouTube)
235239 if self .integration_id is not None :
236240 return RoleType .INTEGRATION
237241
238- raise ValueError ("Unable to determine the role type based on provided tags." )
242+ # Seeing how messed up this is it wouldn't be a surprise if this happened
243+ return RoleType .UNKNOWN
239244
240245 @deprecated ("RoleTags.type" , "2.7" )
241246 def is_bot_managed (self ) -> bool :
0 commit comments