From 58245df9efd23c98a8a40719d0dcaa73b521361a Mon Sep 17 00:00:00 2001 From: Master Kwoth Date: Mon, 14 Mar 2016 01:09:04 +0100 Subject: [PATCH] fixed v+t --- NadekoBot/Commands/VoicePlusTextCommand.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/NadekoBot/Commands/VoicePlusTextCommand.cs b/NadekoBot/Commands/VoicePlusTextCommand.cs index 16bebba0..d12e9dce 100644 --- a/NadekoBot/Commands/VoicePlusTextCommand.cs +++ b/NadekoBot/Commands/VoicePlusTextCommand.cs @@ -30,7 +30,7 @@ namespace NadekoBot.Commands { var beforeVch = e.Before.VoiceChannel; if (beforeVch != null) { var textChannel = - e.Server.FindChannels(beforeVch.Name + "-voice", ChannelType.Text).FirstOrDefault(); + e.Server.FindChannels(GetChannelName(beforeVch.Name), ChannelType.Text).FirstOrDefault(); if (textChannel != null) await textChannel.AddPermissionsRule(e.Before, new ChPermOverride(readMessages: PermValue.Deny, @@ -39,11 +39,11 @@ namespace NadekoBot.Commands { var afterVch = e.After.VoiceChannel; if (afterVch != null) { var textChannel = e.Server.FindChannels( - $"{afterVch.Name}-voice", + GetChannelName(afterVch.Name), ChannelType.Text) .FirstOrDefault(); if (textChannel == null) { - textChannel = (await e.Server.CreateChannel(afterVch.Name + "-voice", ChannelType.Text)); + textChannel = (await e.Server.CreateChannel(GetChannelName(afterVch.Name), ChannelType.Text)); await textChannel.AddPermissionsRule(e.Server.EveryoneRole, new ChPermOverride(readMessages: PermValue.Deny, sendMessages: PermValue.Deny)); @@ -58,6 +58,9 @@ namespace NadekoBot.Commands { }; } + private string GetChannelName(string voiceName) => + voiceName.Replace(" ", "-").Trim() + "-voice"; + internal override void Init(CommandGroupBuilder cgb) { cgb.CreateCommand(Module.Prefix + "v+t") .Alias(Module.Prefix + "voice+text")