33
33
from .flags import RoleFlags
34
34
from .mixins import Hashable
35
35
from .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
+ )
37
43
38
44
__all__ = (
39
45
"RoleTags" ,
@@ -85,10 +91,13 @@ class RoleTags:
85
91
"_premium_subscriber" ,
86
92
"_available_for_purchase" ,
87
93
"_guild_connections" ,
94
+ "_bot_id" ,
95
+ "_bot_role" ,
96
+ "_data" ,
88
97
)
89
98
90
99
def __init__ (self , data : RoleTagPayload ):
91
- self .bot_id : int | None = _get_as_snowflake ( data , "bot_id" )
100
+ self ._data : RoleTagPayload = data
92
101
self .integration_id : int | None = _get_as_snowflake (data , "integration_id" )
93
102
self .subscription_listing_id : int | None = _get_as_snowflake (
94
103
data , "subscription_listing_id"
@@ -104,7 +113,13 @@ def __init__(self, data: RoleTagPayload):
104
113
)
105
114
self ._guild_connections : Any | None = data .get ("guild_connections" , MISSING )
106
115
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 :
108
123
"""Whether the role is associated with a bot."""
109
124
return self .bot_id is not None
110
125
0 commit comments