3333from .flags import RoleFlags
3434from .mixins import Hashable
3535from .permissions import Permissions
36- from .utils import MISSING , _bytes_to_base64_data , _get_as_snowflake , snowflake_time
36+ from .utils import (
37+ MISSING ,
38+ _bytes_to_base64_data ,
39+ _get_as_snowflake ,
40+ cached_slot_property ,
41+ snowflake_time ,
42+ )
3743
3844__all__ = (
3945 "RoleTags" ,
@@ -85,10 +91,13 @@ class RoleTags:
8591 "_premium_subscriber" ,
8692 "_available_for_purchase" ,
8793 "_guild_connections" ,
94+ "_bot_id" ,
95+ "_bot_role" ,
96+ "_data" ,
8897 )
8998
9099 def __init__ (self , data : RoleTagPayload ):
91- self .bot_id : int | None = _get_as_snowflake ( data , "bot_id" )
100+ self ._data : RoleTagPayload = data
92101 self .integration_id : int | None = _get_as_snowflake (data , "integration_id" )
93102 self .subscription_listing_id : int | None = _get_as_snowflake (
94103 data , "subscription_listing_id"
@@ -104,7 +113,13 @@ def __init__(self, data: RoleTagPayload):
104113 )
105114 self ._guild_connections : Any | None = data .get ("guild_connections" , MISSING )
106115
107- def is_bot_managed (self ) -> bool :
116+ @cached_slot_property ("_bot_id" )
117+ def bot_id (self ) -> int | None :
118+ """The bot's user ID that manages this role."""
119+ return int (self ._data .get ("bot_id" , 0 ) or 0 ) or None
120+
121+ @cached_slot_property ("_bot_role" )
122+ def is_bot_role (self ) -> bool :
108123 """Whether the role is associated with a bot."""
109124 return self .bot_id is not None
110125
0 commit comments