Пример #1
0
        public override void Process(IChatClient chatClient, CommandReceivedEventArgs eventArgs)
        {
            TimeSpan?timeSpan = _streamingPlatform.GetUptimeAsync().Result;

            if (timeSpan.HasValue)
            {
                chatClient.SendMessage($"The stream has been going for {timeSpan:hh\\:mm\\:ss}");
            }
            else
            {
                chatClient.SendMessage("Something's Wrong. Are we live right now?");
            }
        }
Пример #2
0
 protected override void HandleCommand(IChatClient chatClient, CommandReceivedEventArgs eventArgs)
 {
     try
     {
         TimeSpan?timeSpan = _streamingPlatform.GetUptimeAsync().Result;
         string   message  = timeSpan.HasValue
             ? $"The stream has been going for {timeSpan:hh\\:mm\\:ss}"
             : "Something's wrong. Are we live right now?";
         chatClient.SendMessage(message);
     }
     catch (Exception e)
     {
         _logger.LogError(e, "Failed trying to get UpTime data.");
     }
 }