daily pastebin goal
9%
SHARE
TWEET

Untitled

a guest Mar 19th, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const TelegramBot = require('node-telegram-bot-api');
  2. //TOKEN Bot
  3. const token = '';
  4.  
  5. const bot = new TelegramBot(token, {polling: true});
  6.  
  7. bot.on('message', function(msg){
  8.    
  9.     const perms = {};
  10.     perms.can_send_message = true;
  11.     perms.can_send_media_messages = true;
  12.     perms.can_send_other_messages = true;
  13.     perms.can_can_add_web_page_previews = true;
  14.  
  15.     var chatId = msg.chat.id;
  16.     var chatitle = msg.chat.title;
  17.    
  18.     if (msg.new_chat_members != undefined){
  19.    
  20.         var nameNewMember = msg.new_chat_member.first_name;
  21.  
  22.         //Manda un mensaje de bienvenida y solicita que haga clic en el boton para verificar
  23.         bot.sendMessage(chatId, "Hola " + nameNewMember + ", bienvenido al grupo de consultas de" + chatitle + "de la UTN - FRBA\nHaga clic en el boton de abajo para verificar que no sea un robot",
  24.             { reply_markup: {
  25.                 inline_keyboard: [
  26.                     [
  27.                         {text: "No soy un bot", callback_data: 'bot'}
  28.                     ]
  29.                 ]
  30.             }});
  31.     }
  32.  
  33.     bot.on('callback_query', function onCallbackQuery(accionboton){
  34.         const data = accionboton.data
  35.         const msg = accionboton.message
  36.  
  37.         if(data == 'bot'){
  38.             bot.deleteMessage(chatId, msg.message_id);
  39.            
  40.         }
  41.     })
  42. }
  43.  
  44. //Cuando aparece solo esa palabra
  45. bot.onText(/^\/empieza/, (msg) => {
  46.   //console.log(msg);
  47.     bot.sendMessage(msg.chat.id, "Las materias de 2do a 6to año empiezan el 18\nFisica 1 curso Z empieza el 25\nRecursantes empiezan el 25 de marzo\nIngresantes empiezan el 1 de Abril\n",{reply_to_message_id: msg.message_id});
  48. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top