Added TTS Filter cache.

This commit is contained in:
Tom
2024-12-27 22:28:22 +00:00
parent 4979553c74
commit 6176e6f3b9
9 changed files with 262 additions and 36 deletions

View File

@@ -24,11 +24,12 @@ namespace HermesSocketServer.Requests
public async Task<RequestResult> Grant(string sender, IDictionary<string, object>? data)
{
if (long.TryParse(data["chatter"].ToString(), out long chatterId))
data["chatter"] = chatterId;
else
if (data == null)
return RequestResult.Failed("Data received from client is null.");
if (!long.TryParse(data["chatter"].ToString(), out long chatterId))
return RequestResult.Failed("Invalid Twitch user id");
data["user"] = sender;
data["voice"] = data["voice"].ToString();
var check = await _database.ExecuteScalar("SELECT state FROM \"TtsVoiceState\" WHERE \"userId\" = @user AND \"ttsVoiceId\" = @voice", data) ?? false;