Fixed more group stuffs.
This commit is contained in:
@@ -27,8 +27,10 @@ namespace TwitchChatTTS.Chat.Groups
|
||||
public void Add(long chatterId, string groupId)
|
||||
{
|
||||
if (_chatters.TryGetValue(chatterId, out var list))
|
||||
{
|
||||
if (!list.Contains(groupId))
|
||||
list.Add(groupId);
|
||||
}
|
||||
else
|
||||
_chatters.Add(chatterId, new List<string>() { groupId });
|
||||
}
|
||||
@@ -37,8 +39,9 @@ namespace TwitchChatTTS.Chat.Groups
|
||||
{
|
||||
if (_chatters.TryGetValue(chatter, out var list))
|
||||
{
|
||||
foreach (var group in groupIds)
|
||||
list.Add(group);
|
||||
foreach (var groupId in groupIds)
|
||||
if (!list.Contains(groupId))
|
||||
list.Add(groupId);
|
||||
}
|
||||
else
|
||||
_chatters.Add(chatter, groupIds);
|
||||
@@ -85,7 +88,7 @@ namespace TwitchChatTTS.Chat.Groups
|
||||
|
||||
public void Modify(Group group)
|
||||
{
|
||||
_groups[group.Name] = group;
|
||||
_groups[group.Id] = group;
|
||||
}
|
||||
|
||||
public bool Remove(string groupId)
|
||||
@@ -104,10 +107,10 @@ namespace TwitchChatTTS.Chat.Groups
|
||||
if (_chatters.TryGetValue(chatterId, out var groups))
|
||||
{
|
||||
groups.Remove(groupId);
|
||||
_logger.Debug($"Removed chatter from group [chatter id: {chatterId}][group name: {_groups[groupId]}][group id: {groupId}]");
|
||||
_logger.Debug($"Removed chatter from group [chatter id: {chatterId}][group name: {_groups[groupId].Name}][group id: {groupId}]");
|
||||
return true;
|
||||
}
|
||||
_logger.Debug($"Failed to remove chatter from group [chatter id: {chatterId}][group name: {_groups[groupId]}][group id: {groupId}]");
|
||||
_logger.Debug($"Failed to remove chatter from group [chatter id: {chatterId}][group name: {_groups[groupId].Name}][group id: {groupId}]");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user