Esempio n. 1
0
 private void CreateTrelloCard(ChatCommand e, string listName)
 {
     try
     {
         var messageArray = CardMessageHandler(e.ArgumentsAsString);
         if (messageArray.Length == 2)
         {
             if (e.ChatMessage.IsModerator ||
                 e.ChatMessage.IsBroadcaster ||
                 e.ChatMessage.IsSubscriber ||
                 e.ChatMessage.IsVip)
             {
                 var testCard = new NewTrelloCard
                 {
                     UserName    = e.ChatMessage.DisplayName,
                     CardName    = messageArray[0],
                     Description = messageArray[1],
                     ListName    = listName
                 };
                 _trelloService.AddNewCardAsync(testCard);
             }
         }
     }
     catch (Exception ex)
     {
         _client.SendMessage(_settings.Channel,
                             $"{e.ChatMessage.DisplayName} That card wasn't created, sorry!!");
         Console.WriteLine($"Failed to write Trello card: {ex.Message}");
     }
 }
 private void CreateTrelloCard(ChatCommand e, string listName)
 {
     try
     {
         if (e.ChatMessage.IsModerator ||
             e.ChatMessage.IsBroadcaster ||
             e.ChatMessage.IsSubscriber ||
             e.ChatMessage.IsVip)
         {
             var messageArray = CardMessageHandler(e.ArgumentsAsString);
             if (messageArray.Length == 2)
             {
                 var testCard = new NewTrelloCard
                 {
                     UserName    = e.ChatMessage.DisplayName,
                     CardName    = messageArray[0],
                     Description = messageArray[1],
                     ListName    = listName
                 };
                 var trelloResponse = _trelloService.AddNewCardAsync(testCard);
                 _client.SendMessage(_settings.Channel, trelloResponse);
             }
             else
             {
                 _client.SendMessage(_settings.Channel, "Hmmm, there was an error parsing your Trello card, please type !trello to see how to format a card command.");
             }
         }
         else
         {
             _client.SendMessage(_settings.Channel,
                                 "Adding a Trello card is only available to subscribers and VIPs, but thanks for getting involved!");
         }
     }
     catch (Exception ex)
     {
         _client.SendMessage(_settings.Channel,
                             $"{e.ChatMessage.DisplayName} That card wasn't created, sorry!!");
         Console.WriteLine($"Failed to write Trello card: {ex.Message}");
     }
 }