Updates from R34

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.

Configurable Telegram Keyboard (advanced topic)

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:

  1. Create a new JSON file (or modify the one bundled with the package), preferably under assets/user_config, let's call it custom_menu.json.
  2. Uncomment (remove the hash "#") from the line 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

  3. Give the JSON file this type of structure, as in the bundled JSON menu file:
    {
     "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.

Main updates in the JSON end .env config files

Here is a short list of the main news: