Skip to content

Commit

Permalink
Completely forgot to actually edit sent_responses
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenny2github committed Jan 16, 2022
1 parent 96ba837 commit 9652262
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions discord/ext/slash/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,16 @@ def _responded(self, rtype: InteractionCallbackType) -> bool:
return self.sent_responses['update']
return True # for unknown rtypes, err on the side of editing

def _set_responded(self, rtype: InteractionCallbackType) -> None:
if rtype == InteractionCallbackType.CHANNEL_MESSAGE_WITH_SOURCE:
self.sent_responses['message'] = True
if rtype == InteractionCallbackType.DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE:
self.sent_responses['message'] = True
if rtype == InteractionCallbackType.UPDATE_MESSAGE:
self.sent_responses['update'] = True
if rtype == InteractionCallbackType.DEFERRED_UPDATE_MESSAGE:
self.sent_responses['update'] = True

async def respond(
self, content=None, *, rtype: InteractionCallbackType = None,
embed: discord.Embed = None, embeds: Iterable[discord.Embed] = None,
Expand Down Expand Up @@ -357,6 +367,7 @@ async def respond(
await self.client.http.request(route, form=msg_data, files=files)
else:
await self.client.http.request(route, json=data)
self._set_responded(rtype)

async def delete(self):
"""Delete the original interaction response message."""
Expand Down

0 comments on commit 9652262

Please sign in to comment.