Example #1
0
        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();
        }
Example #2
0
        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();
        }
Example #3
0
        public IActionResult Start()
        {
            if (_miunie.MiunieDiscord.ConnectionState == ConnectionState.DISCONNECTED)
            {
                _ = _miunie.StartAsync();
            }

            return(RedirectToAction("Index"));
        }
Example #4
0
        public async Task StartButton_ClickCommand()
        {
            if (string.IsNullOrWhiteSpace(DiscordToken))
            {
                return;
            }

            _miunie.BotConfiguration.DiscordToken = DiscordToken;
            await _miunie.StartAsync();
        }
Example #5
0
        public Task ToggleBotConnection()
        {
            if (_miunie.MiunieDiscord.ConnectionState == ConnectionState.DISCONNECTED)
            {
                _ = _miunie.StartAsync();
            }
            else if (_miunie.MiunieDiscord.ConnectionState == ConnectionState.CONNECTED)
            {
                _miunie.Stop();
            }

            return(Task.CompletedTask);
        }