Ejemplo n.º 1
0
        public void Client_OnNewSubscriber(object sender, OnNewSubscriberArgs e)
        {
            var message = $"Welcome {e.Subscriber.DisplayName} to the my lab!";

            if (e.Subscriber.SubscriptionPlan == SubscriptionPlan.Prime)
            {
                message += " So kind of you to use your Twitch Prime on my channel!";
            }

            sayingResponse.SaySomethingNice(message).Wait();

            this.client.SendMessage(e.Channel, message);
        }
Ejemplo n.º 2
0
        public void Handle(OnChatCommandReceivedArgs cmd)
        {
            var message = GetRandomAnswer().ToLower();

            client.SendMessage(cmd.Command.ChatMessage.Channel,
                               $"Hey {cmd.Command.ChatMessage.Username}, {message}");
            sayingResponse.SaySomethingNice(message);
        }
Ejemplo n.º 3
0
        public void Handle(OnChatCommandReceivedArgs cmd)
        {
            try
            {
                var dadJoke = dadJokeService.GetDadJoke(alternateSite).Result;

                sayingResponse.SaySomethingNice(dadJoke.Setup);
                client.SendMessage(cmd.Command.ChatMessage.Channel, $"Q: {dadJoke.Setup}");

                Task.Delay(5000).Wait();

                sayingResponse.SaySomethingNice(dadJoke.Punchline);
                client.SendMessage(cmd.Command.ChatMessage.Channel, $"A: {dadJoke.Punchline}");
            }
            catch (Exception ex)
            {
                alternateSite = "https://karljoke.herokuapp.com/jokes/random";

                sayingResponse.SaySomethingNice(ex.Message);
                client.SendMessage(cmd.Command.ChatMessage.Channel, $"We've got problem {ex.Message}");
            }
        }
Ejemplo n.º 4
0
 public void Handle(OnChatCommandReceivedArgs cmd)
 {
     if (cmd.Command.ChatMessage.IsSubscriber ||
         cmd.Command.ChatMessage.IsVip ||
         cmd.Command.ChatMessage.IsModerator)
     {
         var message = cmd.Command.ArgumentsAsString.Split(' ', 2);
         sayingResponse.SaySomethingNice(message[1]);
     }
     else
     {
         client.SendMessage(cmd.Command.ChatMessage.Channel,
                            $"Hey {cmd.Command.ChatMessage.Username}, the say command is for subscibers and vips only.");
     }
 }
Ejemplo n.º 5
0
        protected override async Task ExecuteAsync(CancellationToken stoppingToken)
        {
            logger.LogInformation("ExecuteAsync fired...");

            while (!stoppingToken.IsCancellationRequested)
            {
                var status = controller?.Read(buttonPin);

                if (status == PinValue.Low)
                {
                    logger.LogInformation("saying words...");
                    var message = scopedSayingResponse.PickSaying();
                    logger.LogInformation($"ExecuteAsync: picked saying {message}");
                    await scopedSayingResponse.SaySomethingNice(message);
                }

                await Task.Delay(100, stoppingToken);
            }
        }