diff --git a/.drone.yml b/.drone.yml index b214529..de4163e 100644 --- a/.drone.yml +++ b/.drone.yml @@ -204,6 +204,6 @@ steps: # path: /drone/volume/mkdocs_cache/gitlab_notification --- kind: signature -hmac: cf1bd0800e8f6bb49dae0a6c5f607676b87d5ee713f4203f4f1ed08a17f71f68 +hmac: e7f6553e0e0ffb44294dfee170fd01441b54cd56a5f4c70638486ac37fcdf047 ... diff --git a/src/main/java/dev/struchkov/example/bot/conf/AppProperty.java b/src/main/java/dev/struchkov/example/bot/conf/AppProperty.java index d8d5cb4..82e90af 100644 --- a/src/main/java/dev/struchkov/example/bot/conf/AppProperty.java +++ b/src/main/java/dev/struchkov/example/bot/conf/AppProperty.java @@ -12,5 +12,6 @@ import org.springframework.stereotype.Component; public class AppProperty { private String telegramId; + private String version; } diff --git a/src/main/java/dev/struchkov/example/bot/unit/StartNotify.java b/src/main/java/dev/struchkov/example/bot/unit/StartNotify.java new file mode 100644 index 0000000..2cbfd9d --- /dev/null +++ b/src/main/java/dev/struchkov/example/bot/unit/StartNotify.java @@ -0,0 +1,43 @@ +package dev.struchkov.example.bot.unit; + +import dev.struchkov.example.bot.conf.AppProperty; +import dev.struchkov.godfather.simple.domain.BoxAnswer; +import dev.struchkov.godfather.telegram.simple.context.service.TelegramSending; +import jakarta.annotation.PostConstruct; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +import java.text.MessageFormat; + +import static dev.struchkov.godfather.telegram.main.context.BoxAnswerPayload.DISABLE_WEB_PAGE_PREVIEW; + +@Component +@RequiredArgsConstructor +public class StartNotify { + + private final TelegramSending sending; + private final AppProperty appProperty; + + @PostConstruct + public void sendStartNotify() { + final BoxAnswer boxAnswer = BoxAnswer.builder() + .message(MessageFormat.format( + """ + Hello 👋 + Your personal ChatGPT bot has been successfully launched. + + Use the help command to find out about the possibilities 🚀 + -- -- -- -- -- + 🤘 Version: {0} + 👨‍💻 Developer: [https://mark.struchkov.dev/](Struchkov Mark) + 💊 Docs: https://docs.struchkov.dev/chatgpt-telegram-bot + """, + appProperty.getVersion() + )) + .payload(DISABLE_WEB_PAGE_PREVIEW, true) + .build(); + boxAnswer.setRecipientIfNull(appProperty.getTelegramId()); + sending.send(boxAnswer); + } + +} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index fa9d26f..e051fe0 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,5 +1,6 @@ app: telegram-id: ${TELEGRAM_ID} + version: 0.0.1-SNAPShOT telegram: bot: username: ${TELEGRAM_BOT_USERNAME}