Advertisement
Guest User

Untitled

a guest
May 24th, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. const login=require("facebook-chat-api");
  3. const axios = require("axios");
  4. var lydo="(Khoa is going defecates)";
  5. var emote =":3 :) :D :( :'( :P O:) 3:) o.O ;) :O -_-  >:O :* <3 ^_^ 8-) >:( ♒ :/ ♊ ☺ (y) :poop: ☀ ☁ ☔ ⚡ ✨ ⭐ ✳ ⛄ ☕ ♨ ⛵ ⛽ ✈ ⛲ ⛺ ⛪ ☎ ✉ ✂ 🚽 🛀 👙 👙 👕 👘 👗 👢 👠 👡 💼 👜 👔 🎩 👒 👑 💍 🚭 ⚽ ⚾ ⚾ ⛳ 🏈 🏀 🎾 🎱 🎯 🎿 🎌 🏁 🏆";
  6. var icon_arr = emote.split(' ');
  7. var icon;
  8. var mem=[];
  9. login({email:"dauvanhuyhoang@yahoo.com.vn", password:"dauvanhuyhoang44"}, function(err, api){
  10.     if (err) return console.log(err);
  11.     api.listen(function(err, mssg){
  12.         if (mssg.body=='on')
  13.             mem[mssg.threadID]='co';
  14.         if (mssg.body=='off')
  15.             mem[mssg.threadID]='khong';
  16.         if (mssg.body=='yes' && !mem[mssg.threadID]){
  17.             mem[mssg.threadID]='co';
  18.         }
  19.         if (mssg.body=='no' && !mem[mssg.threadID]){
  20.             mem[mssg.threadID]='khong';
  21.         }
  22.         if (mem[mssg.threadID]=='khong'){
  23.             return 0;
  24.         }
  25.         icon = " "+icon_arr[Math.round(Math.random()*icon_arr.length)];
  26.         console.log(icon);
  27.                     axios.get('http://api.minhhieu.asia/en.php',{params:{text:mssg.body}}).then(res=>{
  28.                         if (res.data == '  Bạn Chưa Nhập Câu Hỏi. Write a message and hit  to chat! ' || res.data.indexOf('Talk with random person')!=-1)
  29.                             api.sendMessage("I don't understand :3? "+icon , mssg.threadID);
  30.                         else{
  31.                             if (!mem[mssg.threadID])
  32.                                 api.sendMessage('Do you want to chat with chatbot?? (yes/no)  [['+lydo+']]', mssg.threadID);
  33.                             else{
  34.                                 if (mem[mssg.threadID]=='yes')
  35.                                     api.sendMessage(lres.data + icon, mssg.threadID);
  36.                             }
  37.                         }
  38.                         console.log(mssg.body+' - '+res.data);
  39.                     });  
  40.     });
  41.  
  42. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement