Skip to content

Commit

Permalink
Fix webhook send & edit where the thread ID was set (#2572)
Browse files Browse the repository at this point in the history
  • Loading branch information
RedDaedalus authored Oct 23, 2023
1 parent 649d68e commit 7db0f0a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,6 @@ protected RequestBody finalizeData()
if (avatar != null)
json.put("avatar_url", avatar);

if (threadId != null)
{
json.put("thread_id", threadId);
}
else if (threadMetadata != null)
{
json.put("thread_name", threadMetadata.getName());
Expand All @@ -166,6 +162,16 @@ else if (threadMetadata != null)
}
}

@Override
protected Route.CompiledRoute finalizeRoute()
{
Route.CompiledRoute route = super.finalizeRoute();
if (threadId != null)
route = route.withQueryParams("thread_id", threadId);

return route;
}

@Override
protected void handleSuccess(Response response, Request<T> request)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,19 @@ protected RequestBody finalizeData()
try (MessageEditData data = builder.build())
{
DataObject payload = data.toData();
if (threadId != null)
payload.put("thread_id", threadId);
return getMultipartBody(data.getFiles(), payload);
}
}

@Override
protected Route.CompiledRoute finalizeRoute()
{
Route.CompiledRoute route = super.finalizeRoute();
if (threadId != null)
route = route.withQueryParams("thread_id", threadId);
return route;
}

@Override
protected void handleSuccess(Response response, Request<T> request)
{
Expand Down

0 comments on commit 7db0f0a

Please sign in to comment.