The bot is running on the main Thread now
This commit is contained in:
@@ -5,6 +5,7 @@ using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Linq;
|
||||
|
||||
using PluginManager;
|
||||
using PluginManager.Bot;
|
||||
@@ -43,7 +44,7 @@ public class Program
|
||||
Installer.GenerateStartupConfig();
|
||||
}
|
||||
|
||||
HandleInput(args).Wait();
|
||||
HandleInput(args.ToList()).Wait();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -129,20 +130,21 @@ public class Program
|
||||
/// Handle user input arguments from the startup of the application
|
||||
/// </summary>
|
||||
/// <param name="args">The arguments</param>
|
||||
private static async Task HandleInput(string[] args)
|
||||
private static async Task HandleInput(List<string> args)
|
||||
{
|
||||
var len = args.Length;
|
||||
|
||||
Console.WriteLine("Loading Core ...");
|
||||
|
||||
var b = await StartNoGui();
|
||||
consoleCommandsHandler = new ConsoleCommandsHandler(b.client);
|
||||
|
||||
var mainThread = new Thread(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
Console.WriteLine("Launching core functions ...");
|
||||
if(args.Contains("--gui"))
|
||||
{
|
||||
// GUI not implemented yet
|
||||
Console.WriteLine("GUI not implemented yet");
|
||||
return;
|
||||
}
|
||||
NoGUI();
|
||||
}
|
||||
catch (IOException ex)
|
||||
@@ -155,8 +157,7 @@ public class Program
|
||||
Config.Logger.Log("An error occured while closing the bot last time. Please consider closing the bot using the &rsd&c method !\nThere is a risk of losing all data or corruption of the save file, which in some cases requires to reinstall the bot !", "Bot", TextType.ERROR);
|
||||
}
|
||||
}
|
||||
});
|
||||
mainThread.Start();
|
||||
return;
|
||||
}
|
||||
|
||||
private static async Task PreLoadComponents(string[] args)
|
||||
|
||||
Reference in New Issue
Block a user