Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module.exports = new StepScene('sendReq', [
- (ctx) => {
- if (ctx.scene.step.firstTime || !ctx.text) {
- let keyboard = Keyboard.builder()
- .textButton({
- label: "Да",
- payload: {
- command: "yes"
- },
- color: Keyboard.SECONDARY_COLOR
- })
- .textButton({
- label: "Нет",
- payload: {
- command: "no"
- },
- color: Keyboard.SECONDARY_COLOR
- })
- .row()
- .textButton({
- label: "Отмена",
- payload: {
- command: "cancel"
- },
- color: Keyboard.NEGATIVE_COLOR
- })
- return ctx.send('Главный вопрос вселенной FluffyCloud к вам: вы считаете себя адекватным человеком?', { keyboard })
- }
- if (/отмена/i.test(ctx.text) || ctx.messagePayload.command == "cancel") {
- ctx.send('Вы отменили подачу заявки.')
- return ctx.scene.leave({ silent: true })
- }
- if (/да/i.test(ctx.text) == false || ctx.messagePayload.command != "yes") {
- ctx.send('Ваша заявка отклонена по причине неадекватности.')
- return ctx.scene.leave({ silent: true })
- }
- ctx.send('Ответ засчитан.')
- return ctx.scene.step.next()
- },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement