@@ -268,7 +268,6 @@ async def edit(
268268 payload ["components" ] = _components
269269
270270 payload = Message (** payload )
271- self .message = payload
272271 self .message ._client = self .client
273272
274273 return payload
@@ -321,13 +320,11 @@ class CommandContext(_Context):
321320 :ivar Snowflake id: The ID of the interaction.
322321 :ivar Snowflake application_id: The application ID of the interaction.
323322 :ivar InteractionType type: The type of interaction.
324- :ivar str name: The name of the command in the interaction.
325- :ivar Optional[str] description?: The description of the command in the interaction.
326- :ivar Optional[List[Option]] options?: The options of the command in the interaction, if any.
327- :ivar InteractionData data: The application command data.
323+ :ivar InteractionData data?: The application command data.
324+ :ivar Optional[Union[Message, Member, User]] target: The target selected if this interaction is invoked as a context menu.
328325 :ivar str token: The token of the interaction response.
329- :ivar Snowflake channel_id : The ID of the current channel .
330- :ivar Snowflake guild_id : The ID of the current guild .
326+ :ivar Snowflake guild_id? : The ID of the current guild .
327+ :ivar Snowflake channel_id? : The ID of the current channel .
331328 :ivar bool responded: Whether an original response was made or not.
332329 :ivar bool deferred: Whether the response was deferred or not.
333330 :ivar str locale?: The selected language of the user invoking the interaction.
@@ -354,7 +351,6 @@ class CommandContext(_Context):
354351 "channel_id" ,
355352 "responded" ,
356353 "deferred" ,
357- #
358354 "locale" ,
359355 "guild_locale" ,
360356 )
@@ -380,13 +376,14 @@ def __init__(self, **kwargs) -> None:
380376 async def edit (self , content : Optional [str ] = MISSING , ** kwargs ) -> Message :
381377
382378 payload = await super ().edit (content , ** kwargs )
379+ msg = None
383380
384381 if self .deferred :
385382 if hasattr (self .message , "id" ) and self .message .id is not None :
386383 res = await self .client .edit_message (
387384 int (self .channel_id ), int (self .message .id ), payload = payload ._json
388385 )
389- self .message = Message (** res , _client = self .client )
386+ self .message = msg = Message (** res , _client = self .client )
390387 else :
391388 res = await self .client .edit_interaction_response (
392389 token = self .token ,
@@ -402,7 +399,7 @@ async def edit(self, content: Optional[str] = MISSING, **kwargs) -> Message:
402399 await self .client .edit_message (
403400 int (self .channel_id ), res ["id" ], payload = payload ._json
404401 )
405- self .message = Message (** res , _client = self .client )
402+ self .message = msg = Message (** res , _client = self .client )
406403 else :
407404 res = await self .client .edit_interaction_response (
408405 token = self .token ,
@@ -415,8 +412,10 @@ async def edit(self, content: Optional[str] = MISSING, **kwargs) -> Message:
415412 await self .client .edit_message (
416413 int (self .channel_id ), res ["id" ], payload = payload ._json
417414 )
418- self .message = Message (** res , _client = self .client )
415+ self .message = msg = Message (** res , _client = self .client )
419416
417+ if msg is not None :
418+ return msg
420419 return payload
421420
422421 async def defer (self , ephemeral : Optional [bool ] = False ) -> None :
@@ -454,7 +453,7 @@ async def send(self, content: Optional[str] = MISSING, **kwargs) -> Message:
454453 application_id = str (self .application_id ),
455454 )
456455 self .responded = True
457- self .message = Message (** res , _client = self .client )
456+ self .message = msg = Message (** res , _client = self .client )
458457 else :
459458 await self .client ._post_followup (
460459 data = payload ._json ,
@@ -477,8 +476,9 @@ async def send(self, content: Optional[str] = MISSING, **kwargs) -> Message:
477476 msg = Message (** __newdata , _client = self .client )
478477 self .message = msg
479478 self .responded = True
480-
481- return msg or payload
479+ if msg is not None :
480+ return msg
481+ return payload
482482
483483 async def delete (self ) -> None :
484484 """
@@ -569,7 +569,6 @@ class ComponentContext(_Context):
569569 "channel_id" ,
570570 "responded" ,
571571 "deferred" ,
572- #
573572 "locale" ,
574573 "guild_locale" ,
575574 )
@@ -582,6 +581,7 @@ def __init__(self, **kwargs) -> None:
582581 async def edit (self , content : Optional [str ] = MISSING , ** kwargs ) -> Message :
583582
584583 payload = await super ().edit (content , ** kwargs )
584+ msg = None
585585
586586 if not self .deferred :
587587 self .callback = InteractionCallbackType .UPDATE_MESSAGE
@@ -605,7 +605,10 @@ async def edit(self, content: Optional[str] = MISSING, **kwargs) -> Message:
605605 application_id = str (self .application_id ),
606606 )
607607 self .responded = True
608- self .message = Message (** res , _client = self .client )
608+ self .message = msg = Message (** res , _client = self .client )
609+
610+ if msg is not None :
611+ return msg
609612
610613 return payload
611614
@@ -630,7 +633,7 @@ async def send(self, content: Optional[str] = MISSING, **kwargs) -> Message:
630633 application_id = str (self .application_id ),
631634 )
632635 self .responded = True
633- self .message = Message (** res , _client = self .client )
636+ self .message = msg = Message (** res , _client = self .client )
634637 else :
635638 await self .client ._post_followup (
636639 data = payload ._json ,
@@ -654,7 +657,9 @@ async def send(self, content: Optional[str] = MISSING, **kwargs) -> Message:
654657 self .message = msg
655658 self .responded = True
656659
657- return msg or payload
660+ if msg is not None :
661+ return msg
662+ return payload
658663
659664 async def defer (
660665 self , ephemeral : Optional [bool ] = False , edit_origin : Optional [bool ] = False
0 commit comments