private static async Task RunHeadless() { if (!_args.HasToken) { Console.WriteLine(ConsoleStrings.HEADLESS_REQUIRES_TOKEN); Environment.Exit(0); } _miunie.BotConfiguration.DiscordToken = _args.Token; await _miunie.StartAsync(); }
private static async Task RunHeadless(string[] args) { if (!args.Any(arg => arg.StartsWith("-token="))) { Console.WriteLine(ConsoleStrings.HEADLESS_REQUIRES_TOKEN); Environment.Exit(0); } var token = args .First(arg => arg.StartsWith("-token=")) .Substring(7); _miunie.BotConfiguration.DiscordToken = token; await _miunie.StartAsync(); }
public IActionResult Start() { if (_miunie.MiunieDiscord.ConnectionState == ConnectionState.DISCONNECTED) { _ = _miunie.StartAsync(); } return(RedirectToAction("Index")); }
public async Task StartButton_ClickCommand() { if (string.IsNullOrWhiteSpace(DiscordToken)) { return; } _miunie.BotConfiguration.DiscordToken = DiscordToken; await _miunie.StartAsync(); }
public Task ToggleBotConnection() { if (_miunie.MiunieDiscord.ConnectionState == ConnectionState.DISCONNECTED) { _ = _miunie.StartAsync(); } else if (_miunie.MiunieDiscord.ConnectionState == ConnectionState.CONNECTED) { _miunie.Stop(); } return(Task.CompletedTask); }