Beispiel #1
0
 if (is_null($msg)) {
     continue;
 }
 $wrds = explode(' ', $msg['text']);
 $id = $msg['chat']['id'];
 $mid = $msg["message_id"];
 if (($wrds[0] == '/start' || $wrds[0] == '/start' . $bot->getName()) && $bot->isStarted($id) == 0) {
     if ($bot->findUser($id) == 0) {
         $bot->replyToMsg($id, $mid, "Bot started");
         $type = $msg['chat']['type'];
         if ($type == "private") {
             $title = $msg['chat']['username'];
         } else {
             $title = $msg['chat']['title'];
         }
         $bot->addUser($id, $title);
     } else {
         if ($bot->findUser($id) == 1) {
             $bot->replyToMsg($id, $mid, "Bot already running");
         }
     }
     $bot->updateMsg();
 } else {
     if (($wrds[0] == "/stop" || $wrds[0] == "/stop" . $bot->getName()) && $bot->isStarted($id) == 1) {
         if ($bot->findUser($id) == 0) {
             $bot->replyToMsg($id, $mid, "Bot is not running sir");
         } else {
             if ($bot->findUser($id) == 1) {
                 $bot->replyToMsg($id, $mid, "Bot stopped");
                 $bot->updateMsg();
                 $bot->removeUser($id);