Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.54 KB | None | 0 0
  1. <?php
  2.  
  3.     // Include the framework
  4.     require './vendor/autoload.php';
  5. echo "online";
  6. $bot->redis=new Redis();
  7. $redis->connect('127.0.0.1');
  8.     $bot = new PhpBotFramework\Bot("262833394:AAFzZ2zDHMqKoefEKRMXWtvkU76DDCzj0KU");
  9. $bot->getUpdatesLocal();
  10.     if(!$redis->setNx('users', $_chat_id)){
  11.  
  12.     $home_closure = new PhpBotFramework\Commands\MessageCommand("start", function($bot, $message){
  13.  
  14.         $bot->inline_keyboard->addLevelButtons(
  15.                 [
  16.                     'text' => $this->local[$bot->getLanguageRedisAsCache()]['Search_Button'],
  17.                     'callback_data' => 'home_search'
  18.                 ],
  19.                 [
  20.                     'text' => $this->local[$bot->language]['UserSeries_Button'],
  21.                     'callbackdata' => 'home_series'
  22.                 ]
  23.         );
  24.  
  25.         $bot->inline_keyboard->addLevelButtons(
  26.                 [
  27.                     'text' => $this->local[$bot->language]['Calendar_Button'],
  28.                     'callback_data' => 'home_calendar'
  29.                 ]
  30.         );
  31.         $bot->inline_keyboard->addLevelButtons(
  32.                 [
  33.                     'text' => $bot->local[$bot->language]['Profilo'],
  34.                     'callback_data' => 'home_profilo'],
  35.                 [
  36.                     'text' => $bot->local[$bot->language]['Impo'],
  37.                     'callback_data' => 'home_impo'
  38.                 ]
  39.         );
  40.         $bot->sendMessage("$bot->local['Start_Msg']", $bot->inline_keyboard->get());
  41.         echo "user not new";
  42.     }
  43.   );
  44. }
  45.   else {
  46.     $home_closure = new PhpBotFramework\Commands\MessageCommand("start", function($bot, $message){
  47. $bot->sendMessage("buh");
  48. echo "new user in";
  49.   });}
  50.  
  51.     $bot->addCommand($home_closure);
  52.  
  53. $settings=function($bot, $message){
  54.     $bot->inline_keyboard->addLevelButtons(
  55.       ['text'=>$this->localization[$bot->language]['Lingua'],
  56.       'callback_data'=>'settings_languageSettings']);
  57.     if ($Notifications=="TRUE") {
  58.       $bot->inline_keyboard->addLevelButtons(
  59.           ['text'=>$this->localization[$bot->language]['Notifiche_si'],
  60.           'callback_data'=>'change_notificationsStatus']
  61.           );
  62.         }
  63.     elseif ($Notifications=="FALSE") {
  64.       $bot->inline_keyboard->addLevelButtons(
  65.           ['text'=>$this->localization[$bot->language]['Notifiche_no'],
  66.           'callback_data'=>'change_notificationsStatus']
  67.           );
  68.         }
  69.   };
  70. /*
  71.     if($this->eetData() == 'change_notificationsStatus' && $Notifications == 'TRUE'){
  72.         $Notifications="FALSE";
  73.       }*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement