예제 #1
0
 private void PubSub_OnChannelSubscription(object sender, OnChannelSubscriptionArgs e)
 {
     if (e.Subscription.Months > 1)
     {
         chatbot.ManualMessage($"Thanks for {e.Subscription.Months} months of subscription {e.Subscription.Username}!!");
     }
     else
     {
         chatbot.ManualMessage($"Thanks for the subscription {e.Subscription.Username}!");
     }
 }
예제 #2
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);
        }