fix issue where bot would explode on discord reconnect

This commit is contained in:
Madpeter 2023-12-01 08:41:05 +00:00
parent 17c4bb63a9
commit 5adb4b08dc

View file

@ -578,7 +578,14 @@ namespace SecondBotEvents.Services
CleanChannel(channel); CleanChannel(channel);
} }
WantedTextChannels.Remove(channel.Name); WantedTextChannels.Remove(channel.Name);
if (ChannelMap.ContainsKey(channel.Name) == false)
{
ChannelMap[channel.Name] = channel.Id;
return;
}
ChannelMap.Add(channel.Name, channel.Id); ChannelMap.Add(channel.Name, channel.Id);
} }
List<string> WantedCategoryChannels = new List<string> List<string> WantedCategoryChannels = new List<string>
@ -594,6 +601,11 @@ namespace SecondBotEvents.Services
continue; continue;
} }
WantedCategoryChannels.Remove(category.Name); WantedCategoryChannels.Remove(category.Name);
if (ChannelMap.ContainsKey(category.Name) == false)
{
ChannelMap[category.Name] = category.Id;
return;
}
CategoryMap.Add(category.Name, category.Id); CategoryMap.Add(category.Name, category.Id);
} }
foreach(String a in WantedCategoryChannels) foreach(String a in WantedCategoryChannels)