diff --git a/bot.php b/bot.php index f503f7c..a139f18 100644 --- a/bot.php +++ b/bot.php @@ -79,13 +79,16 @@ $serial->deviceClose(); $toReturn = trim(preg_replace('/\s+/', ' ', $devResponse)); - if(strpos($toReturn, "Thank you for doing your part") !== false){ // have sent more than 20 signals - $toReturn = trim(string_between_two_string($toReturn, 'Shared the Signal: ', 'Thank you for doing your part')); - }else{ - $toReturn = trim(string_between_two_string($toReturn, 'Shared the Signal: ', 'se try again')); + if(strpos($toReturn, "Shared the Signal") !== false){ // are sharing the signal + if(strpos($toReturn, "Thank you for doing your part") !== false){ // have sent more than 20 signals + $toReturn = trim(string_between_two_string($toReturn, 'Shared the Signal: ', 'Thank you for doing your part')); + }else{ + $toReturn = trim(string_between_two_string($toReturn, 'Shared the Signal: ', 'se try again')); + } + //echo $toReturn; // DEBUG + }else{ // you havent collected all badge types + $toReturn = 0; } - //echo $toReturn; // DEBUG - return $toReturn; } function string_between_two_string($str, $starting_word, $ending_word){