fixed other people being able to see newly created channels

This commit is contained in:
Master Kwoth 2016-03-10 10:06:36 +01:00
parent 1433ff0e03
commit d9d368a7d1

View File

@ -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));