Advertisement
Guest User

Untitled

a guest
Feb 21st, 2020
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. module.exports = new StepScene('sendReq', [
  2. (ctx) => {
  3.  
  4. if (ctx.scene.step.firstTime || !ctx.text) {
  5. let keyboard = Keyboard.builder()
  6. .textButton({
  7. label: "Да",
  8. payload: {
  9. command: "yes"
  10. },
  11. color: Keyboard.SECONDARY_COLOR
  12. })
  13. .textButton({
  14. label: "Нет",
  15. payload: {
  16. command: "no"
  17. },
  18. color: Keyboard.SECONDARY_COLOR
  19. })
  20. .row()
  21. .textButton({
  22. label: "Отмена",
  23. payload: {
  24. command: "cancel"
  25. },
  26. color: Keyboard.NEGATIVE_COLOR
  27. })
  28. return ctx.send('Главный вопрос вселенной FluffyCloud к вам: вы считаете себя адекватным человеком?', { keyboard })
  29. }
  30.  
  31. if (/отмена/i.test(ctx.text) || ctx.messagePayload.command == "cancel") {
  32. ctx.send('Вы отменили подачу заявки.')
  33. return ctx.scene.leave({ silent: true })
  34. }
  35.  
  36. if (/да/i.test(ctx.text) == false || ctx.messagePayload.command != "yes") {
  37. ctx.send('Ваша заявка отклонена по причине неадекватности.')
  38. return ctx.scene.leave({ silent: true })
  39. }
  40.  
  41. ctx.send('Ответ засчитан.')
  42.  
  43. return ctx.scene.step.next()
  44.  
  45. },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement