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(); }
public static async Task MainAsync(string[] args) { // Start the bot init cycle. // This method as-is creates a voice client (first boolean argument) and says that the bot is targeting Windows 7 (second bool). await XanBotCoreSystem.InitializeBotAsync(BOT_TOKEN, true, true); // Do any other stuff that runs after the bot has connected to discord here. await Task.Delay(-1); }
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); } }