File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -319,6 +319,29 @@ def is_component(self) -> bool:
319
319
"""Indicates whether the interaction is a message component."""
320
320
return self .type == InteractionType .component
321
321
322
+ @utils .cached_slot_property ("_cs_channel" )
323
+ @utils .deprecated ("Interaction.channel" , "2.7" )
324
+ def cached_channel (self ) -> InteractionChannel | None :
325
+ """The cached channel the interaction was sent from.
326
+ DM channels are not resolved. These are :class:`PartialMessageable` instead.
327
+
328
+ .. deprecated:: 2.7
329
+ """
330
+ guild = self .guild
331
+ channel = guild and guild ._resolve_channel (self .channel_id )
332
+ if channel is None :
333
+ if self .channel_id is not None :
334
+ type = (
335
+ ChannelType .text
336
+ if self .guild_id is not None
337
+ else ChannelType .private
338
+ )
339
+ return PartialMessageable (
340
+ state = self ._state , id = self .channel_id , type = type
341
+ )
342
+ return None
343
+ return channel
344
+
322
345
@property
323
346
def permissions (self ) -> Permissions :
324
347
"""The resolved permissions of the member in the channel, including overwrites.
You can’t perform that action at this time.
0 commit comments