Link to see it in work -
you'll need to have Telegram installed in order to use it.
The idea behind this project was to help people do instant actions in emergency situations.
The project was untouched for a long time, so prepare to support legacy non-optimized code
The telegram_bot and utils were built with LookRight in mind.
Which was initially done with these tools.
Requires mongo-db set up. Easily launched via npm pm2 package.
telegram_bot/config.js- change all configurations needed.audio,images,scenariosandvideosfolders contain assets you can refer to from the twine nodes.telegram_bot/index.jsis a starting point for an app.
3.1. In that filelines 42 - 344are for accepting all incoming messages, decomposing them and reacting back.
3.2.Lines 346 - 360replying to button clickstelegram_bot/helpers/messaging.js- contains main messaging logic as the name states. And here is the place where you specify jsons generated from twines withgetStory -> casestands for thefinalattribute in json.- The first file is selected in user object here:
telegram_bot/helpers/user.jsline 40andline 54for selecting first block in the file.
Util commands are used from within the corresponding folders
utils/JSON2Twinery - converts JSON file back to twine file to be used with twinery.
// Put a path to json file you want to convert
15: const json = require('../path/Chapter 2.json'); // Specify the name and path for twinery html file
16: const html = `./${fileNames.name}.html`;Usage: npm build
utils/Twinery2JSON - is kinda a separate mini-app,
which requires it's own npm isntall, since it relies on jsdom package.
// Specify twine html
9: const twine = '../Twines/Chapter 1.html';
// and the output path for jsons
10: const filesPath = '../Twines/Jsons/';Usage: npm install to add needed packages, then just npm index
utils/Twinery2JSON/check-block-existence.js - that's just a simple helper.
It compares blocks English and Russian versions of JSONs, so they have the same blocks.
// Provide the corresponding path names
3: const fileRus = require(path + 'Chapter 0.json');
4: const fileEng = require(path + 'Chapter 0 eng.json');Usage: npm check-block-existence