Added groups & permissions. Fixed TTS user creation. Better connection handling. Fixed 7tv reconnection.

This commit is contained in:
Tom
2024-07-16 04:48:55 +00:00
parent 9fb966474f
commit e6b3819356
45 changed files with 947 additions and 567 deletions

43
Chat/ChatterDatabase.cs Normal file
View File

@@ -0,0 +1,43 @@
namespace TwitchChatTTS.Chat
{
public class ChatterDatabase
{
private readonly IDictionary<string, long> _chatters;
//private readonly HashSet<long> _chatterIds;
public ChatterDatabase()
{
_chatters = new Dictionary<string, long>();
//_chatterIds = new HashSet<long>();
}
public void Add(string username, long chatterId)
{
// if (_chatterIds.TryGetValue(chatterId, out var _)) {
// // TODO: send message to update username for id.
// } else
// _chatterIds.Add(chatterId);
if (_chatters.ContainsKey(username))
_chatters[username] = chatterId;
else
_chatters.Add(username, chatterId);
}
public void Clear()
{
_chatters.Clear();
}
public long? Get(string emoteName)
{
return _chatters.TryGetValue(emoteName, out var chatterId) ? chatterId : null;
}
public void Remove(string emoteName)
{
_chatters.Remove(emoteName);
}
}
}