HelperBot is a Telegram bot designed for managing user notifications and saving files to its database.
#Link for Bot - https://t.me/notify_cation_bot
- User Registration: Users can register using their email address.
- Flexible Notification Scheduling: Users can schedule notifications with flexible date inputs.
- File Storage: Users can send files, which will be saved and available for download.
- Email Notifications: The bot can send notifications via email.
- Multi-format Date Input: Supports various date formats such as
18:00
,30.09 17:59
,завтра о 20:15
, and more. - Supported File Types: Documents, Photos, Audio, Video.
- Data Storage: Uses MySQL to store user data and notifications.
- Task Scheduling: Notification tasks are scheduled and processed using Quartz or other schedulers.
- Message Queue: RabbitMQ is used for asynchronous task processing.
- Java 17
- Spring Boot
- MySQL
- RabbitMQ
- Telegram Bot API
- Quartz Scheduler
- Java 17+
- Docker
- Maven
- Telegram Bot Token (can be obtained from @BotFather)
-
Clone the repository:
git clone https://github.com/koder-dev/TelegramBotNotifications.git cd TelegramBotNotifications
-
Create the configuration file
application.properties
in every module's directory whereapplication.properties.example
is present. -
Fill in the
.env
file based on.env.example
. -
Docker Compose: Run the following command to start the module containers:
docker compose -f docker-compose.yml --env-file .env up --build --detach
-
The bot should now be running and available via Telegram.
- The user sends a message to the bot.
- The message is received by the
dispatcher
module, where the bot instanceTelegramBot
is running. TelegramBot
forwards the message (orUpdate
) to theUpdateController
, where the type ofUpdate
is determined.- Depending on the type of
Update
, it is passed toUpdateProducer
, which uses the RabbitMQ message broker to place it in the appropriate message queue. - Each module has
Consumers
that capture messages from RabbitMQ. - Each module handles a specific function:
- node: Processes Telegram commands and message types and forwards them to other modules.
- rest_module: Handles file uploads from the database and email registration confirmation.
- mail_service: Sends confirmation emails.
- notification_service: Manages all notification logic.
- dispatcher: Initializes the bot and controls
Update
. - common: Contains shared functionality used across all modules.
- The full message flow is:
dispatcher.TelegramBot
->UpdateController
->UpdateProducer
->RabbitQueue
->RabbitListener
->ModuleConsumer
->MainService
->ModuleProducer
->RabbitAnswerQueue
->RabbitAnswerListener
->dispatcher.AnswerConsumer
->UpdateController
->TelegramBot.sendAnswer
.
For any questions, contact t.me/koderdev
.
HelperBot — це Телеграм-бот, розроблений для керування користувацькими сповіщеннями та збереження файлів у базі даних бота.
- Реєстрація користувачів: Користувачі можуть реєструватися за допомогою електронної пошти.
- Гнучке планування сповіщень: Користувачі можуть планувати сповіщення з гнучкими параметрами введення дати.
- Збереження файлів: Користувачі можуть надсилати файли, які будуть збережені та доступні для завантаження.
- Електронні сповіщення: Бот може відправляти сповіщення через електронну пошту.
- Багатоформатне введення дати: Підтримуються різні формати дат, такі як
18:00
,30.09 17:59
,завтра о 20:15
та інші. - Підтримувані типи файлів: Документи, Фото, Аудіо, Відео.
- Збереження даних: Для збереження даних користувачів та сповіщень використовується MySQL.
- Планування завдань: Завдання зі сповіщеннями плануються та обробляються за допомогою Quartz або інших планувальників.
- Черга повідомлень: RabbitMQ використовується для асинхронної обробки завдань.
- Java 17
- Spring Boot
- MySQL
- RabbitMQ
- Telegram Bot API
- Quartz Scheduler
- Java 17+
- Docker
- Maven
- Telegram Bot Token (отримати в @BotFather)
-
Клонування репозиторію:
git clone https://github.com/koder-dev/TelegramBotNotifications.git cd TelegramBotNotifications
-
Створіть файл конфігурації
application.properties
у кожному модулі, де присутній файлapplication.properties.example
. -
Заповніть файл
.env
за зразком.env.example
. -
Docker Compose: Виконайте команду, щоб запустити контейнери модулів:
docker compose -f docker-compose.yml --env-file .env up --build --detach
-
Бот тепер працює та доступний через Telegram.
- Користувач відправляє повідомлення боту.
- Повідомлення надходить у модуль
dispatcher
, де працює екземпляр ботаTelegramBot
. TelegramBot
передає повідомлення (далі —Update
) доUpdateController
, який визначає тип отриманогоUpdate
.- Залежно від типу
Update
, повідомлення передається доUpdateProducer
, який через RabbitMQ додає його до відповідної черги повідомлень. - У кожному модулі реалізовано класи
Consumers
, які перехоплюють повідомлення з RabbitMQ. - Кожен модуль відповідає за свою частину функціоналу:
- node: Відповідає за обробку команд та типів повідомлень Телеграму і передачу їх до інших модулів.
- rest_module: Відповідає за завантаження файлів з бази даних і підтвердження реєстрації електронної пошти.
- mail_service: Відповідає за надсилання листів для підтвердження електронної пошти.
- notification_service: Відповідає за логіку роботи з нагадуваннями.
- dispatcher: Ініціалізація бота та обробка
Update
. - common: Спільний функціонал, який використовується у кожному модулі.
- Повний шлях повідомлення такий:
dispatcher.TelegramBot
->UpdateController
->UpdateProducer
->RabbitQueue
->RabbitListener
->ModuleConsumer
->MainService
->ModuleProducer
->RabbitAnswerQueue
->RabbitAnswerListener
->dispatcher.AnswerConsumer
->UpdateController
->TelegramBot.sendAnswer
.
З будь-якими питаннями звертайтеся до t.me/koderdev
.