mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-04-19 16:33:36 +03:00
Encode Reason field in /ban and /unban to allow for non-ASCII characters
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
parent
d1d0b8ed16
commit
2262a10849
1 changed files with 5 additions and 2 deletions
|
@ -1,4 +1,5 @@
|
|||
using System.ComponentModel;
|
||||
using System.Net;
|
||||
using Boyfriend.Services;
|
||||
using Boyfriend.Services.Data;
|
||||
using Remora.Commands.Attributes;
|
||||
|
@ -86,7 +87,8 @@ public class BanCommand : CommandGroup {
|
|||
return Result.FromError(userResult);
|
||||
|
||||
var banResult = await _guildApi.CreateGuildBanAsync(
|
||||
guildId.Value, target.ID, reason: $"({user.GetTag()}) {reason}", ct: CancellationToken);
|
||||
guildId.Value, target.ID, reason: $"({user.GetTag()}) {WebUtility.UrlEncode(reason)}",
|
||||
ct: CancellationToken);
|
||||
if (!banResult.IsSuccess)
|
||||
return Result.FromError(banResult.Error);
|
||||
|
||||
|
@ -155,7 +157,8 @@ public class BanCommand : CommandGroup {
|
|||
return Result.FromError(userResult);
|
||||
|
||||
var banResult = await _guildApi.CreateGuildBanAsync(
|
||||
guildId.Value, target.ID, reason: $"({user.GetTag()}) {reason}", ct: CancellationToken);
|
||||
guildId.Value, target.ID, reason: $"({user.GetTag()}) {WebUtility.UrlEncode(reason)}",
|
||||
ct: CancellationToken);
|
||||
if (!banResult.IsSuccess)
|
||||
return Result.FromError(banResult.Error);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue