Advertisement
DArcher

Bot Math

Feb 4th, 2015
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.55 KB | None | 0 0
  1. function doMath($bot,$user){
  2.         $mathString = "";
  3.         for($i=4;$i<=count($bot->ex)-1;$i++){
  4.             $mathString .= $bot->ex[$i];
  5.         }
  6. //        $mathString = $this->getParams($bot);
  7.         $mathString = str_replace(array("[","]"," "),array("(",")",""),$mathString);
  8.         if(!$mathString || preg_match("/[a-zA-Z]+/",$mathString)){
  9.             $msg = "No letters in math, I'm not doing algebra for you.";
  10.         }else{
  11.             $msg = "Answer: " . eval("return $mathString;");
  12.         }
  13.         $bot->send_message($msg);
  14.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement