update mainbot.js logic
This commit is contained in:
parent
714853730a
commit
adad94ad43
36
mainbot.js
36
mainbot.js
@ -2,15 +2,19 @@
|
|||||||
|
|
||||||
const PROJECTS_COUNT = 2
|
const PROJECTS_COUNT = 2
|
||||||
|
|
||||||
|
const start_msg = {
|
||||||
|
buttons: [
|
||||||
|
[{ name: { literal: "show_projects" }, callback_name: "project_0" }],
|
||||||
|
[{ name: { literal: "more_info_btn" }, callback_name: "more_info" }],
|
||||||
|
[{ name: { literal: "leave_application" }, callback_name: "leave_application" }],
|
||||||
|
[{ name: { literal: "ask_question_btn" }, callback_name: "ask_question" }],
|
||||||
|
], // default is `null`
|
||||||
|
replace: true,
|
||||||
|
state: "start"
|
||||||
|
};
|
||||||
const dialog = {
|
const dialog = {
|
||||||
commands: {
|
commands: {
|
||||||
start: {
|
start: start_msg,
|
||||||
buttons: [
|
|
||||||
[{name: {literal: "more_info_btn"}, callback_name: "more_info"}],
|
|
||||||
[{name: {literal: "show_projects"}, callback_name: "project_0"}],
|
|
||||||
], // default is `null`
|
|
||||||
state: "start"
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
buttons: {
|
buttons: {
|
||||||
more_info: {
|
more_info: {
|
||||||
@ -18,14 +22,11 @@ const dialog = {
|
|||||||
[{ name: { name: "На главную" }, callback_name: "start" }],
|
[{ name: { name: "На главную" }, callback_name: "start" }],
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
start: {
|
start: start_msg,
|
||||||
buttons: [
|
leave_application: {
|
||||||
[{name: {literal: "more_info_btn"}, callback_name: "more_info"}],
|
handler: leave_application
|
||||||
[{name: {literal: "show_projects"}, callback_name: "project_0"}],
|
|
||||||
], // default is `null`
|
|
||||||
replace: true,
|
|
||||||
state: "start"
|
|
||||||
},
|
},
|
||||||
|
ask_question: {}
|
||||||
},
|
},
|
||||||
stateful_msg_handlers: {
|
stateful_msg_handlers: {
|
||||||
start: {}, // everything is by default, so just send message `start`
|
start: {}, // everything is by default, so just send message `start`
|
||||||
@ -39,6 +40,13 @@ const dialog = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function leave_application(user) {
|
||||||
|
print(JSON.stringify(user))
|
||||||
|
user_application(user)
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
function enter_name() { }
|
function enter_name() { }
|
||||||
|
|
||||||
const fmt = (number) => number.toString().padStart(2, '0');
|
const fmt = (number) => number.toString().padStart(2, '0');
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user