Fixed errors related to managing emotes.

This commit is contained in:
Tom
2025-01-15 14:08:15 +00:00
parent 125f71e779
commit 00cea32cfa

View File

@ -26,10 +26,7 @@ namespace HermesSocketServer.Socket.Handlers
if (message is not EmoteDetailsMessage data || sender.Id == null)
return;
if (data.Emotes == null)
return;
if (!data.Emotes.Any())
if (data.Emotes == null || !data.Emotes.Any())
return;
lock (_lock)
@ -38,7 +35,7 @@ namespace HermesSocketServer.Socket.Handlers
{
if (_emotes.Contains(entry.Key))
{
_emotes.Remove(entry.Key);
data.Emotes.Remove(entry.Key);
continue;
}
@ -46,6 +43,9 @@ namespace HermesSocketServer.Socket.Handlers
}
}
if (!data.Emotes.Any())
return;
int rows = 0;
string sql = "INSERT INTO \"Emote\" (id, name) VALUES (@idd, @name)";
using (var connection = await _database.DataSource.OpenConnectionAsync())