From d9d368a7d110cb6ee4c3042411e7c37819c1a477 Mon Sep 17 00:00:00 2001 From: Master Kwoth Date: Thu, 10 Mar 2016 10:06:36 +0100 Subject: [PATCH] fixed other people being able to see newly created channels --- NadekoBot/Commands/VoicePlusTextCommand.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/NadekoBot/Commands/VoicePlusTextCommand.cs b/NadekoBot/Commands/VoicePlusTextCommand.cs index d6cae33d..fde95a33 100644 --- a/NadekoBot/Commands/VoicePlusTextCommand.cs +++ b/NadekoBot/Commands/VoicePlusTextCommand.cs @@ -37,11 +37,16 @@ namespace NadekoBot.Commands { } var afterVch = e.After.VoiceChannel; if (afterVch != null) { - var textChannel = - e.Server.FindChannels(afterVch.Name + "-voice", ChannelType.Text).FirstOrDefault() ?? - (await e.Server.CreateChannel(afterVch.Name + "-voice", ChannelType.Text)); - if (textChannel == null) - return; + var textChannel = e.Server.FindChannels( + $"{afterVch.Name}-voice", + ChannelType.Text) + .FirstOrDefault(); + if (textChannel == null) { + textChannel = (await e.Server.CreateChannel(afterVch.Name + "-voice", ChannelType.Text)); + await textChannel.AddPermissionsRule(e.Server.EveryoneRole, + new ChPermOverride(readMessages: PermValue.Deny, + sendMessages: PermValue.Deny)); + } await textChannel.AddPermissionsRule(e.After, new ChPermOverride(readMessages: PermValue.Allow, sendMessages: PermValue.Allow));