Multiple bug fixes

Fixed:
URL detection regex
Application crashes when a message is sent in the read-only channel
Application does not exit correctly
This commit is contained in:
Stone-Red-Code
2021-08-01 18:08:44 +02:00
parent a1609916c2
commit 3d8d1d4709
9 changed files with 15 additions and 6 deletions
Binary file not shown.
+1 -1
View File
@@ -179,7 +179,7 @@ namespace DiscordCLI
} }
catch (Exception ex) catch (Exception ex)
{ {
ConsoleExt.WriteLine(ex, ConsoleColor.Red); ConsoleExt.WriteLine(ex.Message, ConsoleColor.Red);
GlobalInformation.currentTextChannel = null; GlobalInformation.currentTextChannel = null;
} }
} }
+12 -3
View File
@@ -76,9 +76,18 @@ namespace DiscordCLI
else if (GlobalInformation.currentTextChannel != null) else if (GlobalInformation.currentTextChannel != null)
{ {
cooldown++; cooldown++;
Console.Write("\r" + new string(' ', Console.WindowWidth));
await GlobalInformation.currentTextChannel.SendMessageAsync(rawInput); try
return (false, false); {
await GlobalInformation.currentTextChannel.SendMessageAsync(rawInput);
Console.Write("\r" + new string(' ', Console.WindowWidth));
}
catch (Exception ex)
{
Console.WriteLine();
ConsoleExt.WriteLine(ex.Message, ConsoleColor.Red);
}
return (false, true);
} }
Console.WriteLine(); Console.WriteLine();
+1 -2
View File
@@ -158,7 +158,7 @@ namespace DiscordCLI
} }
} }
foreach (Match match in Regex.Matches(message, @"((https?)\://|www.)[A-Za-z0-9\.\-]+(/[A-Za-z0-9\?\&\=;\+!'\(\)\*\-\._~%]*)*", RegexOptions.IgnoreCase)) foreach (Match match in Regex.Matches(message, @"((https?)\:\/\/|www.)[A-Za-z0-9\.\-\&\#\?\/]*", RegexOptions.IgnoreCase))
{ {
message = message.Replace(match.Value, $"\0<C{(int)ConsoleColor.Blue}C>{match.Value}\0"); message = message.Replace(match.Value, $"\0<C{(int)ConsoleColor.Blue}C>{match.Value}\0");
} }
@@ -178,7 +178,6 @@ namespace DiscordCLI
else else
{ {
consoleColor = ClosestConsoleColor(color); consoleColor = ClosestConsoleColor(color);
} }
if (consoleColor == Console.BackgroundColor || consoleColor == ConsoleColor.DarkGray) if (consoleColor == Console.BackgroundColor || consoleColor == ConsoleColor.DarkGray)
+1
View File
@@ -89,6 +89,7 @@ namespace DiscordCLI
outputManager.InputManager = inputManager; outputManager.InputManager = inputManager;
await inputManager.ReadInput(); await inputManager.ReadInput();
Environment.Exit(0);
} }
private async void Updater_NoUpdateAvailible() private async void Updater_NoUpdateAvailible()
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.