Added HTML decode to fix issues with users who have apostrophes in their username

This commit is contained in:
barelyprofessional
2024-06-28 11:09:39 +08:00
parent 2e4616c736
commit adf9ad2d87

View File

@@ -1,4 +1,5 @@
using System.Text.Json; using System.Net;
using System.Text.Json;
using KfChatDotNetKickBot.Models; using KfChatDotNetKickBot.Models;
using KfChatDotNetKickBot.Services; using KfChatDotNetKickBot.Services;
using KfChatDotNetWsClient; using KfChatDotNetWsClient;
@@ -253,7 +254,8 @@ public class KickBot
} }
else if (message.MessageRaw.StartsWith("!whois")) else if (message.MessageRaw.StartsWith("!whois"))
{ {
var lookup = message.MessageRaw.Replace("!whois ", string.Empty).TrimStart('@').TrimEnd(' ').TrimEnd(','); var lookup = WebUtility.HtmlDecode(message.MessageRaw.Replace("!whois ", string.Empty)
.TrimStart('@').TrimEnd(' ').TrimEnd(','));
if (_userIdMapping.ContainsKey(lookup)) if (_userIdMapping.ContainsKey(lookup))
{ {
_sendChatMessage($"{lookup}'s ID is {_userIdMapping[lookup]}", true); _sendChatMessage($"{lookup}'s ID is {_userIdMapping[lookup]}", true);