Skip to content

Commit

Permalink
feat: 1 помощь
Browse files Browse the repository at this point in the history
  • Loading branch information
popstas committed Feb 15, 2019
1 parent 3349437 commit 1cfd1dd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
Binary file modified assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions src/commands/core/greetings.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ const matchers = require('../../matchers');
// команда по умолчанию (справка)
module.exports = {
intent: '',
matcher: matchers.strings(['', 'привет', 'приветствие', 'здравствуй']),
matcher: matchers.strings(['', 'привет', 'приветствие', 'здравствуй', '1 помощь']),
// matcher: ['привет', 'приветствие'], // TODO: заменить после выхода sdk 2.0.7

async handler(ctx) {
if (ctx.message != 'ping') ctx.logMessage(`> ${ctx.message} (welcome)`);
let msg;
const buttons = ['список покупок', 'авторизация', 'что нового', 'помощь', 'примеры', 'что ты знаешь', 'команды'];
if (ctx.user.state.visitor.visits > 1 || ctx.user.state.visit.messages > 1) {
if (ctx.message != '1 помощь' && (ctx.user.state.visitor.visits > 1 || ctx.user.state.visit.messages > 1)) {
// TODO: разные приветствия
msg =
'Привет' +
Expand All @@ -22,7 +22,7 @@ module.exports = {
return ctx.reply(msg, buttons);
} else {
msg = [
'Я умею запоминать что где лежит или вести список покупок.',
'Я умею вести список покупок.',
'Хотите ознакомиться с возможностями на примере?'
];
return ctx.confirm(msg, help.tour.handler, help.help.handler);
Expand Down
8 changes: 8 additions & 0 deletions static/scenarios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
- ""
- tests: [ { contains: Привет } ]

"1 помощь":
- привет
- Привет
- 1 помощь
- tests: [ { contains: Я умею } ]
- нет
- tests: [ { contains: '' } ]

"ping":
- ping
- tests: [ { contains: "" } ] # хак, принимает любой ответ
Expand Down

0 comments on commit 1cfd1dd

Please sign in to comment.