Advertisement
xxraferxx

Mensaje de bienvenida

Mar 22nd, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. bot.on('message', function(msg){
  2.  
  3. var verify = {
  4. "inline_keyboard": [
  5. [
  6. {text: "Haga clic aquí", callback_data: 'verificarbot'}
  7. ]
  8. ]
  9. };
  10.  
  11. var data = {
  12. "reply_markup": JSON.stringify(verify)
  13. };
  14.  
  15. /*const perms2 = {};
  16. perms.can_send_message = false;
  17. perms.can_send_media_messages = false;
  18. perms.can_send_other_messages = false;
  19. perms.can_add_web_page_previews = false;*/
  20.  
  21. /* msg.new_chat_members.forEach(function(){
  22.  
  23. });*/
  24.  
  25. if (msg.new_chat_members != undefined){
  26. //bot.restrictChatMember(msg.chat.id, msg.new_chat_members.id, perms2).then(function(result){
  27. bot.sendMessage(msg.chat.id, "Hola " + msg.new_chat_members.id + ", bienvenido al grupo de consultas " + msg.chat.title + " de la UTN - FRBA\n\nHaga clic en el boton de abajo para verificar que no sea un bot.", data);
  28. //})
  29. }
  30. });
  31.  
  32. bot.on('callback_query', function onCallbackQuery(accionboton){
  33. const data = accionboton.data
  34. const msg = accionboton.message
  35.  
  36. /* const perms = {};
  37. perms.can_send_message = true;
  38. perms.can_send_media_messages = true;
  39. perms.can_send_other_messages = true;
  40. perms.can_add_web_page_previews = true;*/
  41.  
  42. if (data === 'verificarbot'){
  43. //bot.restrictChatMember(msg.chat.id, msg.new_chat_members.id, perms).then(function(result){
  44. bot.sendMessage(msg.chat.id, "El usuario " + msg.new_chat_members.first_name + " ha sido verificado \u2705");
  45. // })
  46. };
  47. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement