#!/usr/bin/php getIssues(['q'=>$word]) as $issue){ // loop through the current issues comments foreach($issue->getComments() as $comment){ // if the comment body matches if(($comment->user->login=='Bot') && (strpos($comment->body,$word)!==false)){ // delete the commend $repo->deleteComment($comment); } } } }