This project is a Telegram bot that allows students to make laundry room reservations. It also provides a web interface for users to access the same functionality in case Telegram is down. The bot and web UI support both English and Russian languages and offer a user-friendly interface with emojis.
- Reserve a time slot in the laundry room for up to one hour.
- Configure notification preferences for reservation start and end times.
- View and edit reservation data through both Telegram and the web UI.
- Language selection between English and Russian.
- Automatic backups of the SQLite database.
-
Clone this repository.
-
Install the required dependencies using npm:
npm install
-
Set up your Telegram bot and obtain the bot token from the BotFather.
-
Configure your bot token in
src/bot/config.js
. -
Run the bot and web server:
npm run start
- Open the Telegram app and search for your bot using the bot's username.
- Follow the bot's instructions to provide your room number, first and second name, and phone number on the first launch. The bot will remember this information for future reservations.
- Use the following commands to interact with the bot:
/reserve
- Start the reservation process and select a time slot./view
- View your current reservations and available time slots./cancel
- Cancel an existing reservation./settings
- Configure your notification preferences.
Access the web interface by navigating to http://localhost:3000
in your web browser. You can use the web UI to perform the same actions available in the Telegram bot.
To access the admin interface, navigate to http://localhost:3000/admin
in your web browser. Log in using admin credentials. The admin interface allows viewing and editing reservation data for all users.
- To set the notification preferences, go to the
/settings
command in the Telegram bot or the web UI's settings page. - You can configure the backup frequency by changing the schedule in
src/bot/index.js
.
Contributions are welcome! Feel free to open issues and submit pull requests for new features, bug fixes, or improvements.
This project is licensed under the MIT License. See the LICENSE file for details.
File Structure:
project_root/
├── src/
│ ├── bot/
│ │ ├── config.js
│ │ ├── database.js
│ │ ├── index.js
│ │ ├── language.js
│ │ ├── reservations.js
│ │ └── notifications.js
│ ├── web/
│ │ ├── public/
│ │ │ ├── css/
│ │ │ │ ├── styles.css
│ │ │ │ └── bootstrap.min.css
│ │ │ └── js/
│ │ │ ├── main.js
│ │ │ └── bootstrap.bundle.min.js
│ │ ├── views/
│ │ │ ├── index.html
│ │ │ └── admin.html
│ │ ├── app.js
│ │ ├── database.js
│ │ └── routes.js
├── backups/
├── db/
│ └── reservations.db
├── .gitignore
├── package.json
├── package-lock.json
└── README.md
File Contents:
-
config.js
(inside bot/): Configuration file for your Telegram bot. -
database.js
(inside bot/): Logic to handle interactions with the SQLite database. -
index.js
(inside bot/): Main entry point for the Telegram bot. -
language.js
(inside bot/): Language translation logic. -
reservations.js
(inside bot/): Logic to manage reservations. -
notifications.js
(inside bot/): Logic for sending notifications. -
styles.css
(inside web/public/css/): Custom CSS for the web interface. -
bootstrap.min.css
(inside web/public/css/): Minified Bootstrap CSS file. -
main.js
(inside web/public/js/): JavaScript file for the web interface. -
bootstrap.bundle.min.js
(inside web/public/js/): Minified Bootstrap JS file. -
index.html
(inside web/views/): Main web page for users to make reservations. -
admin.html
(inside web/views/): Web page for the admin to view and edit data. -
app.js
(inside web/): Main entry point for the web server. -
database.js
(inside web/): Logic to handle interactions with the SQLite database for the web interface. -
routes.js
(inside web/): Define routes and handlers for the web server. -
.gitignore
: File to specify files/folders that should be ignored by Git. -
package.json
: File containing information about the Node.js project and its dependencies. -
package-lock.json
: Lockfile generated by npm to ensure consistent package installations. -
README.md
: The README file for your GitHub project.