public override async Task ExecuteCommandAsync(BotContext context, XanBotMember executingMember, DiscordMessage originalMessage, string[] args, string allArgs) { if (originalMessage != null) { await ResponseUtil.RespondToAsync(originalMessage, "Sending shutdown signal and shutting down..."); } XanBotCoreSystem.Exit(); }
static void Main(string[] args) { Console.Title = "Optional console title here."; DoVTConsoleTest(); try { MainAsync(args).ConfigureAwait(false).GetAwaiter().GetResult(); XanBotCoreSystem.Exit(); } catch (Exception ex) { XanBotLogger.WriteException(ex); XanBotLogger.WriteLine("§1Press any key to quit."); Console.ReadKey(true); XanBotCoreSystem.Exit(1); } }
/// <summary> /// Starts the update console task, which handles console input. /// </summary> /// <returns></returns> public static void StartUpdateConsoleTask() { try { Task.Run(() => { while (!XanBotCoreSystem.WantsToExit) { UpdateConsole(); } }); } catch (Exception ex) { // Will probably be a TaskCanceledException XanBotLogger.WriteException(ex); XanBotCoreSystem.Exit(1); } }