The R34 release of Zweb Booking Bot is meant to significantly improve the overall experience, and allow for the presence of a whole companion web application: the admin panel. The panel will be packed with the bot starting from version R36, but its use is completely optional. The configuration structure has undergone some major changes and included some new entries in order to prepare the bot for future updates (such as the admin panel) and at the same time to improve the code organization.
Starting from R35, Service Managers will have the option to change the bottom Telegram menu keyboard layout and buttons, via a separate JSON configuration file. In order to activate a custom bottom keyboard, follow these steps:
assets/user_config, let's call it custom_menu.json.USE_KEEPER_CUSTOM_MENU of the .env file and insert the path of your JSON menu file inside the double quotes, e.g. USE_KEEPER_CUSTOM_MENU="assets/user_config/custom_menu.json"
This lets the bot know you want to replace the standard elements of the menu keyboard with the custom entries shown
{
"entries": [
[
{
"command": "active_reservations"
},
{
"command": "cancel_reservation"
}
],
[
{
"command": "control_panel"
}
],
[
{
"command": "edit_reservation"
},
{
"command": "all_active_reservations_text"
}
],
[
{
"command": ".list CON",
"raw": 1
}
]
]
}
In this file each couple of square brackets represents a row of the keyboard, while each couple of curly brackets inside it represents a single button. The value after command represents the associated command that button refers to; remember: this command has to match the property name (the label) of a keeper command or a user command as in the main config file, for example: "control_panel". Wrong values in the menu file may easily lead to crashes of the bot.
By default, the values must match commands like "help" or "location", those that are shown with a leading slash "/" in the Telegram Keyboard and are technically called Telegram commands; you must not insert the slash, the bot will do it for you, and will show the corresponding JSON text value of the command as in the main config file: for instance, if the main config file contains the following string "active_reservations": "my_reservations" in the user commands section, if you enter "command": "active_reservations" inside the menu file, the bot will show a button with text: /my_reservations.
However, you can also declare some commands as "raw", by inserting the property "raw" : 1 like shown above: this way, the command will be interpreted as a normal, custom text command as is and will be shown unaltered in a button. In the example above, with .list CON we leverage the ability of the bot to list all the reservations relative to the service whose code is "CON" (in the default main config file, this refers to the sample service named "Consulting"). Even in this case, the 'raw' text command must match a pattern that has a meaning, that is must match one of the main config file commands. For example, you can create a menu button with {"command": ".get latest 20", "raw": 1} to see a list with the last 20 reservations.
Here is a short list of the main news:
assets/user_config folder, while not mandatory.text object; this way, all the strings will be translatable from the admin panel editor, and the config file is more intuitive;"reserved_to_keeper": 1 inside a duration option object. ask_note_text: if this property is put inside a service object, instead of asking for confirmation of the reservation, the user will receive this text message and be asked to write a note: the note will override their personal name as reservation name in the ticket AND in the database!admin_color: This will be used, inside each service, to show a colored curve of the reservations month by month in a chart that will appear in the homepage of the admin panel. If missing, default color is blue.day_off_code: Here you have to specify a short, upper/snake-case code, like "DAY_OFF", that is how you the day off pseudo-service is recognized in the bot. Recommended for future compatibility: maximum 7 characters. PRIMARYCONFIG: this options has been added in the .env file. Now you will be able to specify 'db' or 'file' as your main options source. Until the admin panel release, only 'file' will be working and you don't need to change anything.short_name property is to retain only a cosmetic function. Wherever it was used, code property is now used instead.