Advertisement
Guest User

canSubscribeBotAsync

a guest
Jan 17th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ////Bots
  2. SubscribeBot()
  3. {    
  4.  if (typeof FBInstant === 'undefined')return false;
  5.  
  6.     FBInstant.player.canSubscribeBotAsync().then(
  7.         (_canSubscribe)=>{
  8.              
  9.             console.log("can_subsscribe"+_canSubscribe)
  10.  
  11.             if(_canSubscribe)
  12.             {
  13.                 FBInstant.player.subscribeBotAsync().then(
  14.                     ()=>{
  15.                         console.log("player subscribed")
  16.                         this.CallBot();
  17.                     }
  18.                    
  19.  
  20.                     ).catch(function (e) {
  21.                     console.log(e);
  22.                 });
  23.             }
  24.         }
  25.       );
  26. }
  27.  
  28. CallBot(_time:number=24)
  29. {
  30.     if (typeof FBInstant === 'undefined') return;
  31.     const MESSAGE_TO_BOT = { message: "Don't panic!" };
  32.  
  33.     console.log(MESSAGE_TO_BOT);
  34.    
  35.     FBInstant.setSessionData(MESSAGE_TO_BOT);
  36.     const entryPointData = FBInstant.getEntryPointData();
  37.  
  38.    
  39.      FBInstant.setSessionData(MESSAGE_TO_BOT) ;
  40.  
  41.    
  42.  
  43.     FBInstant.setSessionData({
  44.         type:'PLAY_AGAIN',
  45.         playAgainWaitTime:_time
  46.       });
  47.  
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement