Skip to content

Commit 701c7a6

Browse files
Add send_response
plskillme x_x Co-authored-by: BobDotCom <[email protected]>
1 parent c89469c commit 701c7a6

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

discord/commands/context.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,15 @@ def respond(self):
138138
return self.interaction.response.send_message
139139
else:
140140
raise RuntimeError(f"Interaction was already issued a response. Try using {type(self).__name__}.send_followup() instead.")
141-
141+
142+
@property
143+
async def send_response(self) -> Callable[..., Union[Interaction, Webhook]]:
144+
"""Callable[..., Union[:class:`~.Interaction`, :class:`~.Webhook`]]: Sends either a response or a followup response depending if the interaction has been responded to yet or not.
145+
if not self.response.is_done():
146+
return self.interaction.response.send_message # self.response
147+
else:
148+
return self.followup.send # self.send_followup
149+
142150
@property
143151
def send_followup(self):
144152
if self.response.is_done():

0 commit comments

Comments
 (0)