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; var afterVch = e.After.VoiceChannel;
if (afterVch != null) { if (afterVch != null) {
var textChannel = var textChannel = e.Server.FindChannels(
e.Server.FindChannels(afterVch.Name + "-voice", ChannelType.Text).FirstOrDefault() ?? $"{afterVch.Name}-voice",
(await e.Server.CreateChannel(afterVch.Name + "-voice", ChannelType.Text)); ChannelType.Text)
if (textChannel == null) .FirstOrDefault();
return; 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, await textChannel.AddPermissionsRule(e.After,
new ChPermOverride(readMessages: PermValue.Allow, new ChPermOverride(readMessages: PermValue.Allow,
sendMessages: PermValue.Allow)); sendMessages: PermValue.Allow));