Skip to content

Commit

Permalink
Merge pull request #308 from b-rad15/main
Browse files Browse the repository at this point in the history
Change thread_id from Form to Query String param
  • Loading branch information
Nihlus authored Jul 27, 2023
2 parents 2c28f3c + df9a6ba commit 6970169
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,11 @@ public virtual Task<Result<IMessage?>> ExecuteWebhookAsync
b.AddQueryParameter("wait", realShouldWait.ToString());
}
if (threadID.TryGet(out var realThreadID))
{
b.AddQueryParameter("thread_id", realThreadID.ToString());
}
Optional<IReadOnlyList<IPartialAttachment>> attachmentList = default;
if (attachments.TryGet(out var realAttachments))
{
Expand Down Expand Up @@ -354,7 +359,6 @@ public virtual Task<Result<IMessage?>> ExecuteWebhookAsync
json.Write("tts", isTTS, this.JsonOptions);
json.Write("embeds", embeds, this.JsonOptions);
json.Write("allowed_mentions", allowedMentions, this.JsonOptions);
json.Write("thread_id", threadID, this.JsonOptions);
json.Write("components", components, this.JsonOptions);
json.Write("attachments", attachmentList, this.JsonOptions);
json.Write("flags", flags, this.JsonOptions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,11 @@ public async Task PerformsInThreadRequestCorrectly()
(
b => b
.Expect(HttpMethod.Post, $"{Constants.BaseURL}webhooks/{webhookId}/{token}")
.WithQueryString("wait", shouldWait.ToString())
.WithExactQueryString(new Dictionary<string, string>
{
{ "wait", shouldWait.ToString() },
{ "thread_id", threadID.ToString() },
})
.WithJson
(
j => j.IsObject
Expand All @@ -827,7 +831,6 @@ public async Task PerformsInThreadRequestCorrectly()
.WithProperty("avatar_url", p => p.Is(avatarUrl))
.WithProperty("tts", p => p.Is(tts))
.WithProperty("allowed_mentions", p => p.IsObject())
.WithProperty("thread_id", p => p.Is(threadID.ToString()))
.WithProperty("components", p => p.IsArray())
.WithProperty("flags", p => p.Is((int)flags))
)
Expand Down

0 comments on commit 6970169

Please sign in to comment.