From 374d302a41d876ebd172fd8abfc3fc286e53c6ad Mon Sep 17 00:00:00 2001 From: Master Kwoth Date: Tue, 3 May 2016 06:28:55 +0200 Subject: [PATCH] Fixed some v+t edge cases, ref #252 --- .../Modules/Administration/Commands/VoicePlusTextCommand.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/NadekoBot/Modules/Administration/Commands/VoicePlusTextCommand.cs b/NadekoBot/Modules/Administration/Commands/VoicePlusTextCommand.cs index a1e1df94..9d5d8543 100644 --- a/NadekoBot/Modules/Administration/Commands/VoicePlusTextCommand.cs +++ b/NadekoBot/Modules/Administration/Commands/VoicePlusTextCommand.cs @@ -1,16 +1,18 @@ using Discord; using Discord.Commands; using NadekoBot.Classes; +using NadekoBot.Extensions; using NadekoBot.Modules.Permissions.Classes; using System; using System.Linq; +using System.Text.RegularExpressions; using ChPermOverride = Discord.ChannelPermissionOverrides; namespace NadekoBot.Modules.Administration.Commands { internal class VoicePlusTextCommand : DiscordCommand { - + Regex channelNameRegex = new Regex(@"[^a-zA-Z0-9 -]", RegexOptions.Compiled); public VoicePlusTextCommand(DiscordModule module) : base(module) { // changing servers may cause bugs @@ -79,7 +81,7 @@ namespace NadekoBot.Modules.Administration.Commands } private string GetChannelName(string voiceName) => - voiceName.Replace(" ", "-").Trim() + "-voice"; + channelNameRegex.Replace(voiceName, "").Trim().Replace(" ", "-").TrimTo(90, true) + "-voice"; internal override void Init(CommandGroupBuilder cgb) {