Example #1
0
        private async Task StartBots()
        {
            while (!_guildsAvailable)
            {
                await Task.Delay(100);
            }

            Console.WriteLine("Guilds available. Starting bots");

            try
            {
                _sankakuBot = new SankakuBot(this._client);                 // Is Seperate Thread
                _sankakuBot.Initialize();

                _waifujoiBot = new WaifuJOIBot(this._client);                 // Is Seperate Thread
                await _waifujoiBot.Start();

                _eventBot = new EventBot(this._client, _cancellationTokenSource.Token);                 // Is Seperate Thread
                await _eventBot.Start();

                _pornhubBot = new PornhubBot(this._client, _cancellationTokenSource.Token); // Is Seperate Thread

                _helpBot = new HelpBot(this._client);                                       // Is Seperate Thread

                this.SetCommands();
            }
            catch (Exception e)
            {
                Console.Error.WriteLine(e);
            }
        }
Example #2
0
        public async Task MainAsync(string[] args)
        {
            this.SetConfig(args);

            _sankakuBot = new SankakuBot(this._client); // Is Seperate Thread
            _sankakuBot.Initialize();

            _waifujoiBot = new WaifuJOIBot(this._client); // Is Seperate Thread
            await _waifujoiBot.Start();

            this.SetCommands();
            this.CreateFolders();

            await this._client.ConnectAsync();

            this._client.MessageCreated     += this.ClientMessageCreated;
            this._client.GuildMemberUpdated += this.ClientGuildMemberUpdated;

            await this._client.UpdateStatusAsync(new DiscordGame("Feetsies"), UserStatus.Online);

            // TODO: Looks weird, cause unused.
            try
            {
                PornhubBot pornhubBot = new PornhubBot(this._client); // Is Seperate Thread

                HelpBot helpBot = new HelpBot(this._client);          // Is Seperate Thread
            }
            catch (Exception e)
            {
                Console.Error.WriteLine(e);
            }

            await AnnounceVersion();

            await Task.Run(() =>
            {
                var exit = false;
                while (!exit)
                {
                    string command = Console.ReadLine();
                    switch (command)
                    {
                    case "stop":
                    case "exit":
                    case "x":
                        PornhubBot.Exit = true;
                        exit            = true;
                        break;
                    }
                }
            });

            await this._client.DisconnectAsync();
        }