This Telegram bot generates a custom confinement form on the fly with the ability to specify the creation time/date.
To roll your own bot just follow these steps:
- Create your bot in Telegram and get the API token, instructions: Creating a new bot.
- Use the
\setcommands
to create thegenerate
command for your bot. - Send a message to you bot and visit the link
https://api.telegram.org/bot**YourBOTToken**/getUpdates
in order to retrieve the chat id. - Clone this repository:
git clone https://github.com/khllkcm/AttestationBot.git
. - Go to the project directory:
cd AttestationBot
. - Fill out the
.env
file with your information. - Install the dependencies:
npm install
. - Make sure to install forever:
[sudo] npm install forever -g
. - Start the bot:
forever src/app.js
.
The main (and only) command is \generate DATE TIME DELAY
.
DATE
is the date on which you plan to go out, it has to be formatted as DD/MM/YYYY. You can use "today" to use the current date.
TIME
is the time on which you plan to go out, it has to be formatted as HH:MM.
DELAY
is the number of minutes before TIME
that will be inscribed as the form creation time. For example, if you plan on leaving your house at 10:00 and you use a delay of 20, the form will have a creation time of 9:40. This is useful for creating a form on the spot but still, #STAYHOME.
The bot will reply asking you for the reasons you will be going out. Tap to select, tap again to deselect.
The bot will inform you of which reasons are currently selected and once you tap DONE it will generate the form.
The code for generating the PDF file borrows heavily from the official implementation by the French Interior Ministry in order to ensure complete compliance. It is a pure NodeJS version of the ES6 code they used that has been simplified and refactored.