This repository has been archived by the owner on Jul 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added new commands (crystball, calc)
- Loading branch information
Showing
6 changed files
with
125 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module.exports = { | ||
name: 'calc', | ||
description: 'Калькулятор', | ||
async first_scene(vk, bot, prefix, lang, config, ctx, Markup, Scene, Stage, math){ | ||
ctx.scene.next(); | ||
ctx.reply(lang.calc_message); | ||
}, | ||
async second_scene(vk, bot, prefix, lang, config, ctx, Markup, Scene, Stage, math) { | ||
try { | ||
ctx.session.content = ctx.message.text; | ||
let result = math.evaluate(ctx.session.content).toString(); | ||
ctx.scene.leave(); | ||
ctx.reply(lang.calc_answer1(result)); | ||
} catch(ex) { | ||
console.log(ex) | ||
ctx.scene.leave(); | ||
ctx.reply(lang.calc_answer2); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module.exports = { | ||
name: 'crystball', | ||
description: 'Игра \"Магический шар\" подбирает случайные ответы.', | ||
async first_scene(vk, bot, prefix, lang, config, ctx, Markup, Scene, Stage){ | ||
ctx.scene.next(); | ||
ctx.reply(lang.crystball_message); | ||
}, | ||
async second_scene(vk, bot, prefix, lang, config, ctx, Markup, Scene, Stage) { | ||
let answers = lang.crystball_answers; | ||
ctx.session.content = ctx.message.text; | ||
let rand = Math.floor(Math.random() * answers.length); | ||
ctx.scene.leave(); | ||
ctx.reply(`${answers[rand]}`); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module.exports = { | ||
name: 'menu', | ||
description: 'Список команд для VK-версии бота VisionOne', | ||
async execute(vk, bot, prefix, lang, config, ctx, Markup){ | ||
ctx.reply(lang.menu_message, null, Markup.keyboard([ | ||
[ | ||
Markup.button(lang.menu_buttons[0], 'primary'), | ||
Markup.button(lang.menu_buttons[1]), | ||
], | ||
[ | ||
Markup.button(lang.menu_buttons[2]), | ||
Markup.button(lang.menu_buttons[3]), | ||
], | ||
[ | ||
Markup.button(lang.menu_buttons[4]) | ||
] | ||
]).inline()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters