Exemplo n.º 1
0
        static void Main(string[] args)
        {
            if (Configs.CheckSetup() == false)
            {
                Configs.FirstTimeSetup();
            }

            TwitchChatBot bot    = new TwitchChatBot();
            PubSub        pubSub = new PubSub(ref bot);

            bot.Connect();
            pubSub.Connect();

            do
            {
                var input = Console.ReadLine();
                if (input.ToLowerInvariant() == "exit")
                {
                    bot.Disconnect();
                    pubSub.Disconnect();
                    Environment.Exit(0);
                }
                else
                {
                    if (input.StartsWith("/w"))
                    {
                        string[] substrings = input.Split();
                        string   receiver   = substrings[1];
                        string   message    = "";
                        int      target     = substrings.Length;

                        for (int i = 2; i < target; i++)
                        {
                            message += $"{substrings[i]} ";
                        }
                        bot.ManualWhisper(receiver, message);
                    }
                    else
                    {
                        bot.ManualMessage(input);   // Dev testing to send messages to chat, remove when unnecessary
                    }
                }
            } while (GlobalOptions.IsConnected == true);
        }