Fixed carbonitex data sending, fixed v+t haveing duplicate channels

This commit is contained in:
Kwoth
2016-10-25 13:06:37 +02:00
parent f82b3633f1
commit 916612311b
4 changed files with 35 additions and 4 deletions

View File

@@ -70,7 +70,7 @@ namespace NadekoBot.Modules.Administration
var beforeVch = before.VoiceChannel;
if (beforeVch != null)
{
var textChannel = guild.GetTextChannels().Where(t => t.Name == GetChannelName(beforeVch.Name)).FirstOrDefault();
var textChannel = guild.GetTextChannels().Where(t => t.Name == GetChannelName(beforeVch.Name).ToLowerInvariant()).FirstOrDefault();
if (textChannel != null)
await textChannel.AddPermissionOverwriteAsync(user,
new OverwritePermissions(readMessages: PermValue.Deny,
@@ -80,11 +80,11 @@ namespace NadekoBot.Modules.Administration
if (afterVch != null && guild.AFKChannelId != afterVch.Id)
{
var textChannel = guild.GetTextChannels()
.Where(t => t.Name == GetChannelName(afterVch.Name))
.Where(t => t.Name == GetChannelName(afterVch.Name).ToLowerInvariant())
.FirstOrDefault();
if (textChannel == null)
{
textChannel = (await guild.CreateTextChannelAsync(GetChannelName(afterVch.Name)).ConfigureAwait(false));
textChannel = (await guild.CreateTextChannelAsync(GetChannelName(afterVch.Name).ToLowerInvariant()).ConfigureAwait(false));
await textChannel.AddPermissionOverwriteAsync(guild.EveryoneRole,
new OverwritePermissions(readMessages: PermValue.Deny,
sendMessages: PermValue.Deny)).ConfigureAwait(false);
@@ -163,7 +163,7 @@ namespace NadekoBot.Modules.Administration
}
var allTxtChannels = guild.GetTextChannels().Where(c => c.Name.EndsWith("-voice"));
var validTxtChannelNames = guild.GetVoiceChannels().Select(c => GetChannelName(c.Name));
var validTxtChannelNames = guild.GetVoiceChannels().Select(c => GetChannelName(c.Name).ToLowerInvariant());
var invalidTxtChannels = allTxtChannels.Where(c => !validTxtChannelNames.Contains(c.Name));