32
32
from discord .webhook .async_ import Webhook
33
33
34
34
if TYPE_CHECKING :
35
+ from typing import Awaitable , Callable
36
+
35
37
from typing_extensions import ParamSpec
36
38
37
39
import discord
38
- from .. import Bot
39
- from ..state import ConnectionState
40
- from ..voice_client import VoiceClient
41
40
42
- from .core import ApplicationCommand , Option
43
- from ..interactions import InteractionChannel
41
+ from .. import Bot
42
+ from ..client import ClientUser
43
+ from ..cog import Cog
44
44
from ..guild import Guild
45
+ from ..interactions import InteractionChannel
45
46
from ..member import Member
46
47
from ..message import Message
47
- from ..user import User
48
48
from ..permissions import Permissions
49
- from ..client import ClientUser
50
-
51
- from ..cog import Cog
49
+ from ..state import ConnectionState
50
+ from .. user import User
51
+ from ..voice_client import VoiceClient
52
52
from ..webhook import WebhookMessage
53
-
54
- from typing import Callable , Awaitable
55
-
56
- from ..utils import cached_property
53
+ from .core import ApplicationCommand , Option
57
54
58
55
T = TypeVar ("T" )
59
56
CogT = TypeVar ("CogT" , bound = "Cog" )
@@ -142,53 +139,53 @@ def command(self) -> ApplicationCommand | None:
142
139
def command (self , value : ApplicationCommand | None ) -> None :
143
140
self .interaction .command = value
144
141
145
- @cached_property
142
+ @property
146
143
def channel (self ) -> InteractionChannel | None :
147
144
"""Union[:class:`abc.GuildChannel`, :class:`PartialMessageable`, :class:`Thread`]:
148
145
Returns the channel associated with this context's command. Shorthand for :attr:`.Interaction.channel`.
149
146
"""
150
147
return self .interaction .channel
151
148
152
- @cached_property
149
+ @property
153
150
def channel_id (self ) -> int | None :
154
151
"""Returns the ID of the channel associated with this context's command.
155
152
Shorthand for :attr:`.Interaction.channel_id`.
156
153
"""
157
154
return self .interaction .channel_id
158
155
159
- @cached_property
156
+ @property
160
157
def guild (self ) -> Guild | None :
161
158
"""Returns the guild associated with this context's command.
162
159
Shorthand for :attr:`.Interaction.guild`.
163
160
"""
164
161
return self .interaction .guild
165
162
166
- @cached_property
163
+ @property
167
164
def guild_id (self ) -> int | None :
168
165
"""Returns the ID of the guild associated with this context's command.
169
166
Shorthand for :attr:`.Interaction.guild_id`.
170
167
"""
171
168
return self .interaction .guild_id
172
169
173
- @cached_property
170
+ @property
174
171
def locale (self ) -> str | None :
175
172
"""Returns the locale of the guild associated with this context's command.
176
173
Shorthand for :attr:`.Interaction.locale`.
177
174
"""
178
175
return self .interaction .locale
179
176
180
- @cached_property
177
+ @property
181
178
def guild_locale (self ) -> str | None :
182
179
"""Returns the locale of the guild associated with this context's command.
183
180
Shorthand for :attr:`.Interaction.guild_locale`.
184
181
"""
185
182
return self .interaction .guild_locale
186
183
187
- @cached_property
184
+ @property
188
185
def app_permissions (self ) -> Permissions :
189
186
return self .interaction .app_permissions
190
187
191
- @cached_property
188
+ @property
192
189
def me (self ) -> Member | ClientUser | None :
193
190
"""Union[:class:`.Member`, :class:`.ClientUser`]:
194
191
Similar to :attr:`.Guild.me` except it may return the :class:`.ClientUser` in private message
@@ -200,14 +197,14 @@ def me(self) -> Member | ClientUser | None:
200
197
else self .bot .user
201
198
)
202
199
203
- @cached_property
200
+ @property
204
201
def message (self ) -> Message | None :
205
202
"""Returns the message sent with this context's command.
206
203
Shorthand for :attr:`.Interaction.message`, if applicable.
207
204
"""
208
205
return self .interaction .message
209
206
210
- @cached_property
207
+ @property
211
208
def user (self ) -> Member | User :
212
209
"""Returns the user that sent this context's command.
213
210
Shorthand for :attr:`.Interaction.user`.
@@ -226,7 +223,7 @@ def voice_client(self) -> VoiceClient | None:
226
223
227
224
return self .interaction .guild .voice_client
228
225
229
- @cached_property
226
+ @property
230
227
def response (self ) -> InteractionResponse :
231
228
"""Returns the response object associated with this context's command.
232
229
Shorthand for :attr:`.Interaction.response`.
@@ -268,7 +265,7 @@ def unselected_options(self) -> list[Option] | None:
268
265
return self .command .options # type: ignore
269
266
return None
270
267
271
- @cached_property
268
+ @property
272
269
def attachment_size_limit (self ) -> int :
273
270
"""Returns the attachment size limit associated with this context's interaction.
274
271
Shorthand for :attr:`.Interaction.attachment_size_limit`.
0 commit comments