Skip to content

Commit 3bb7932

Browse files
committed
Escape standard emoji name in URI (fix #114)
1 parent a50e79c commit 3bb7932

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

NetCord/Rest/RestClient.Channel.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,11 @@ public Task DeleteAllMessageReactionsAsync(ulong channelId, ulong messageId, Res
118118
public Task DeleteAllMessageReactionsAsync(ulong channelId, ulong messageId, ReactionEmojiProperties emoji, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)
119119
=> SendRequestAsync(HttpMethod.Delete, $"/channels/{channelId}/messages/{messageId}/reactions/{ReactionEmojiToString(emoji)}", null, new(channelId), properties, cancellationToken: cancellationToken);
120120

121-
private static string ReactionEmojiToString(ReactionEmojiProperties emoji) => emoji.Id.HasValue ? $"{emoji.Name}:{emoji.Id.GetValueOrDefault()}" : emoji.Name;
121+
private static string ReactionEmojiToString(ReactionEmojiProperties emoji)
122+
{
123+
var id = emoji.Id;
124+
return id.HasValue ? $"{emoji.Name}:{id.GetValueOrDefault()}" : Uri.EscapeDataString(emoji.Name);
125+
}
122126

123127
[GenerateAlias([typeof(TextChannel)], nameof(TextChannel.Id))]
124128
[GenerateAlias([typeof(RestMessage)], nameof(RestMessage.ChannelId), nameof(RestMessage.Id), TypeNameOverride = "Message")]

0 commit comments

Comments
 (0)