Skip to content

Commit

Permalink
Check interactions are still not acknowledged
Browse files Browse the repository at this point in the history
  • Loading branch information
freya022 committed Feb 22, 2024
1 parent 0918871 commit 638c407
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,9 @@ public AuditableRestAction<Void> delete()
@Override
protected void handleErrorResponse(Response response, Request<Void> request, ErrorResponseException exception)
{
if (webhook instanceof InteractionHookImpl && exception.getErrorResponse() == ErrorResponse.UNKNOWN_WEBHOOK)
if (webhook instanceof InteractionHookImpl
&& !((InteractionHookImpl) webhook).isAck()
&& exception.getErrorResponse() == ErrorResponse.UNKNOWN_WEBHOOK)
request.onFailure(new IllegalStateException("Sending a webhook request requires the interaction to be acknowledged before expiration"));
else
super.handleErrorResponse(response, request, exception);
Expand Down Expand Up @@ -854,7 +856,9 @@ public AuditableRestAction<Void> suppressEmbeds(boolean suppressed)
@Override
protected void handleErrorResponse(Response response, Request<Void> request, ErrorResponseException exception)
{
if (webhook instanceof InteractionHookImpl && exception.getErrorResponse() == ErrorResponse.UNKNOWN_WEBHOOK)
if (webhook instanceof InteractionHookImpl
&& !((InteractionHookImpl) webhook).isAck()
&& exception.getErrorResponse() == ErrorResponse.UNKNOWN_WEBHOOK)
request.onFailure(new IllegalStateException("Sending a webhook request requires the interaction to be acknowledged before expiration"));
else
super.handleErrorResponse(response, request, exception);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ protected void handleSuccess(Response response, Request<Message> request)
@Override
protected void handleErrorResponse(Response response, Request<Message> request, ErrorResponseException exception)
{
if (webhook instanceof InteractionHookImpl && exception.getErrorResponse() == ErrorResponse.UNKNOWN_WEBHOOK)
if (webhook instanceof InteractionHookImpl
&& !((InteractionHookImpl) webhook).isAck()
&& exception.getErrorResponse() == ErrorResponse.UNKNOWN_WEBHOOK)
request.onFailure(new IllegalStateException("Sending a webhook request requires the interaction to be acknowledged before expiration"));
else
super.handleErrorResponse(response, request, exception);
Expand Down

0 comments on commit 638c407

Please sign in to comment.