Skip to content

Commit

Permalink
URL-Encode reasons on Kick/Ban (#787)
Browse files Browse the repository at this point in the history
This resolves #784
  • Loading branch information
foxbot authored and Auralytical committed Aug 17, 2017
1 parent dfcb4b3 commit 95b78df
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Discord.Net.Rest/DiscordRestApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ public async Task CreateGuildBanAsync(ulong guildId, ulong userId, CreateGuildBa
options = RequestOptions.CreateOrClone(options);

var ids = new BucketIds(guildId: guildId);
string reason = string.IsNullOrWhiteSpace(args.Reason) ? "" : $"&reason={args.Reason}";
string reason = string.IsNullOrWhiteSpace(args.Reason) ? "" : $"&reason={Uri.EscapeDataString(args.Reason)}";
await SendAsync("PUT", () => $"guilds/{guildId}/bans/{userId}?delete-message-days={args.DeleteMessageDays}{reason}", ids, options: options).ConfigureAwait(false);
}
public async Task RemoveGuildBanAsync(ulong guildId, ulong userId, RequestOptions options = null)
Expand Down Expand Up @@ -988,7 +988,7 @@ public async Task RemoveGuildMemberAsync(ulong guildId, ulong userId, string rea
options = RequestOptions.CreateOrClone(options);

var ids = new BucketIds(guildId: guildId);
reason = string.IsNullOrWhiteSpace(reason) ? "" : $"?reason={reason}";
reason = string.IsNullOrWhiteSpace(reason) ? "" : $"?reason={Uri.EscapeDataString(reason)}";
await SendAsync("DELETE", () => $"guilds/{guildId}/members/{userId}{reason}", ids, options: options).ConfigureAwait(false);
}
public async Task ModifyGuildMemberAsync(ulong guildId, ulong userId, Rest.ModifyGuildMemberParams args, RequestOptions options = null)
Expand Down

0 comments on commit 95b78df

Please sign in to comment.