Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const {StepScene} = require('@vk-io/scenes')
- const {Keyboard} = require('vk-io')
- module.exports = new StepScene('register', [
- async (ctx) => {
- if(ctx.scene.step.firstTime || !ctx.messagePayload.agree) {
- console.log(ctx)
- let keyboard = Keyboard.builder()
- keyboard.textButton({label: 'Да', payload: {agree: true}, color: Keyboard.POSITIVE_COLOR})
- keyboard.textButton({label: 'Нет', payload: {agree: false}, color: Keyboard.NEGATIVE_COLOR})
- return ctx.send({
- message: 'СОГЛАШЕНИЕ О ТОМ ЧТО ВЫ НЕ НОРМАЛЬНЫЙ ЧЕЛОВЕК',
- keyboard
- })
- }
- ctx.scene.state.agree = ctx.messagePayload.agree;
- return ctx.scene.step.next()
- }, async (ctx) => {
- if (ctx.scene.step.firstTime || !ctx.text) {
- if (!ctx.scene.state.agree)
- return ctx.scene.leave()
- if (ctx.scene.state.agree == true)
- return ctx.send({
- message: 'КАК ТЕБЯ ЗВАТЬ????????'
- })
- }
- return ctx.scene.step.next()
- }, async (ctx) => {
- if (ctx.scene.step.firstTime || !ctx.text) {
- let keyboard = Keyboard.builder()
- keyboard.textButton({label: 'Да', payload: {agree: true}, color: Keyboard.POSITIVE_COLOR})
- keyboard.textButton({label: 'Нет', payload: {agree: false}, color: Keyboard.NEGATIVE_COLOR})
- return ctx.send({
- message: 'Я ТЕБЯ ЗАРЕГАЛ!!!!!!'
- })
- }
- let user = new ctx._bot.db.user({id: ctx.senderId, slug: ctx.text})
- user.save().then(() => {
- return ctx.send({
- message: 'ВСЕ Я ТЕБЯ ЗАРЕГАЛ'
- })
- }).catch((err) => {
- ctx._bot.vk.api.call('meesages.send', {
- message: 'АШИБКА:\n\n' + err,
- user_id: 366668990,
- random_id: 0
- })
- return ctx.send({
- message: 'АШИПКА!!!\n Создателю уже пришел репорт с ошибкой'
- })
- })
- return ctx.scene.leave()
- }
- ])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement