{"id":317068,"date":"2021-01-27T21:00:39","date_gmt":"2021-01-27T21:00:39","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=317068"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=317068","title":{"rendered":"\u041f\u0438\u0448\u0435\u043c Telegram Bot \u0434\u043b\u044f \u043e\u043f\u043e\u0432\u0435\u0449\u0435\u043d\u0438\u044f \u043e \u043a\u043e\u043c\u043c\u0438\u0442\u0435 \u0432 git \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u0430\u0440\u0438\u0439 \u043d\u0430 \u0431\u0430\u0437\u0435 Gitea \u0438 \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0435\u0433\u043e \u0432 Google Cloud Platform"},"content":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<p>\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435 \u043a\u0430\u043a \u0438 \u043e\u0431\u0435\u0449\u0430\u043b \u0432 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435 \u043c\u043e\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043e <a href=\"https:\/\/habr.com\/ru\/post\/539400\/\" rel=\"noopener noreferrer nofollow\">\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 Google Play<\/a> , \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u044e \u0432 \u0434\u0435\u0442\u0430\u043b\u044f\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f Telegram Bot`a \u0434\u043b\u044f \u043e\u043f\u043e\u0432\u0435\u0449\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u043e\u0432 \u043e \u0432\u044b\u043f\u0443\u0441\u043a\u0435 \u043d\u043e\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438.<\/p>\n<h2>\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f Bota \u0432 Telegram \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 ID<\/h2>\n<p>\u041f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e&nbsp;<a href=\"https:\/\/tele.gs\/botfather\" rel=\"noopener noreferrer nofollow\">@BotFather<\/a>&nbsp;\u0438&nbsp;\u0441\u043b\u0435\u0434\u0443\u0439\u0442\u0435 \u0435\u0433\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c. <\/p>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b<\/p>\n<pre><code>\/start \/newbot bot_name<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u0412 \u0438\u0442\u043e\u0433\u0435 \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435<\/summary>\n<div class=\"spoiler__content\">\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ccc\/320\/c64\/ccc320c64d807f7b66dcddc925e60e5b.PNG\" width=\"415\" height=\"263\"><figcaption><\/figcaption><\/figure>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0418\u0437 \u044d\u0442\u043e\u0433\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e <\/p>\n<ul>\n<li>\n<p>t.me\/bot_name &#8212; \u0418\u043c\u044f \u0431\u043e\u0442\u0430 \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0435\u0433\u043e \u0432 \u043a\u0430\u043d\u0430\u043b\u044b \u0438\u043b\u0438 \u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u041b\u0421<\/p>\n<\/li>\n<li>\n<p>token &#8212; \u044d\u0442\u043e \u043d\u0430\u0448 \u043a\u043b\u044e\u0447 \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a API<\/p>\n<\/li>\n<\/ul>\n<h2>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a<\/h2>\n<p>\u041d\u0430\u0448 \u0431\u043e\u0442 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 Java \u0438 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0438\u0437 \u0441\u0435\u0431\u044f Spring Boot Web \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0441\u0431\u043e\u0440\u043a\u0438 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f maven<\/p>\n<p>1) \u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 Spring Boot \u043f\u0440\u043e\u0435\u043a\u0442, \u043f\u0440\u043e\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0442\u043e\u0440 \u0432 <strong><em>IntelliJ IDEA <\/em><\/strong>, \u043b\u0438\u0431\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f <a href=\"https:\/\/start.spring.io\/\" rel=\"noopener noreferrer nofollow\">Spring Initializr<\/a>. <\/p>\n<p>\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0442\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0435 \u043d\u0443\u0436\u043d\u044b\u043c\u0438, \u043d\u043e \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u043c \u043f\u043e\u0434\u043e\u0439\u0434\u0451\u0442 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440<\/p>\n<details class=\"spoiler\">\n<summary>pom.xml<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"xml\">    &lt;parent&gt;         &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;         &lt;artifactId&gt;spring-boot-starter-parent&lt;\/artifactId&gt;         &lt;version&gt;2.1.6.RELEASE&lt;\/version&gt;         &lt;relativePath\/&gt; &lt;!-- lookup parent from repository --&gt;     &lt;\/parent&gt;      &lt;properties&gt;         &lt;java.version&gt;1.8&lt;\/java.version&gt;     &lt;\/properties&gt;      &lt;dependencies&gt;         &lt;dependency&gt;             &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;             &lt;artifactId&gt;spring-boot-starter-web&lt;\/artifactId&gt;         &lt;\/dependency&gt;          &lt;dependency&gt;             &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;             &lt;artifactId&gt;spring-boot-starter-test&lt;\/artifactId&gt;             &lt;scope&gt;test&lt;\/scope&gt;         &lt;\/dependency&gt;         &lt;dependency&gt;             &lt;groupId&gt;org.telegram&lt;\/groupId&gt;             &lt;artifactId&gt;telegrambots&lt;\/artifactId&gt;             &lt;version&gt;5.0.0&lt;\/version&gt;         &lt;\/dependency&gt;         &lt;dependency&gt;             &lt;groupId&gt;com.google.code.gson&lt;\/groupId&gt;             &lt;artifactId&gt;gson&lt;\/artifactId&gt;             &lt;version&gt;2.8.6&lt;\/version&gt;         &lt;\/dependency&gt;          &lt;dependency&gt;             &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;             &lt;artifactId&gt;spring-boot-configuration-processor&lt;\/artifactId&gt;             &lt;optional&gt;true&lt;\/optional&gt;         &lt;\/dependency&gt;          &lt;dependency&gt;             &lt;groupId&gt;org.projectlombok&lt;\/groupId&gt;             &lt;artifactId&gt;lombok&lt;\/artifactId&gt;             &lt;optional&gt;true&lt;\/optional&gt;         &lt;\/dependency&gt;       &lt;\/dependencies&gt;      &lt;build&gt;         &lt;plugins&gt;             &lt;plugin&gt;                 &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;                 &lt;artifactId&gt;spring-boot-maven-plugin&lt;\/artifactId&gt;             &lt;\/plugin&gt;         &lt;\/plugins&gt;     &lt;\/build&gt; <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 :<\/summary>\n<div class=\"spoiler__content\">\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3c7\/2dd\/b0f\/3c72ddb0f0c7c9ca68e3b65bca7179c3.PNG\" width=\"354\" height=\"589\"><figcaption><\/figcaption><\/figure>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u0435\u0439 \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u043a\u043b\u0430\u0441\u0441\u0443 : <\/p>\n<details class=\"spoiler\">\n<summary>BotConfig &#8212; \u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u043f\u043e\u0434\u0442\u044f\u0433\u0438\u0432\u0430\u044e\u0449\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0431\u043e\u0442\u0430 \u0438\u0437 application.properties<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"java\">@Configuration @Data @PropertySource(\"classpath:application.properties\") public class BotConfig {      \/\/ \u0418\u043c\u044f \u0431\u043e\u0442\u0430 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438     @Value(\"${botUserName}\")     String botUserName;      \/\/ \u0422\u043e\u043a\u0435\u043d \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438     @Value(\"${token}\")     String token; }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>BotInitializer &#8212; Component \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438\/\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0431\u043e\u0442\u0430 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 Telegram<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"java\">@Component @Slf4j public class BotInitializer {     @Autowired     Bot bot;      @EventListener({ContextRefreshedEvent.class})     public void Init() throws TelegramApiException {         TelegramBotsApi telegramBotsApi = new TelegramBotsApi(DefaultBotSession.class);         try {             telegramBotsApi.registerBot(bot);         } catch (TelegramApiRequestException e) {             log.error(exceptionStackTraceToString(e));         }     } }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0422\u0435\u043b\u0435\u0433\u0440\u0430\u043c API \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0443\u0436\u0435 \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u0434\u043d\u044f\u0442\u0438\u044f \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 Spring, \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u0432\u0435\u0448\u0430\u0435\u043c \u0441\u043b\u0443\u0448\u0430\u0442\u0435\u043b\u044c \u043d\u0430 ContextRefreshedEvent<\/p>\n<details class=\"spoiler\">\n<summary>Bot &#8212; \u0421\u0435\u0440\u0432\u0438\u0441 \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u0432 \u0441\u0435\u0431\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e TelegramLongPollingBot,<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"java\">@Component @Slf4j \/**  * \u041a\u0430\u0441\u0441 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u043f\u0443\u043b\u043e\u043c \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 Telegram  * \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435, \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430, \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439  *\/ public class Bot extends TelegramLongPollingBot {      final     BotConfig config;      public Bot(BotConfig config) {         this.config = config;     }      public void onUpdateReceived(Update update) {         update.getUpdateId();         SendMessage.SendMessageBuilder builder =SendMessage.builder();         String messageText;         String chatId;         if (update.getMessage() != null) {             chatId = update.getMessage().getChatId().toString();             builder.chatId(chatId);             messageText = update.getMessage().getText();         } else {             chatId = update.getChannelPost().getChatId().toString();             builder.chatId(chatId);             messageText = update.getChannelPost().getText();         }          if (messageText.contains(\"\/hello\")) {             builder.text(\"\u041f\u0440\u0438\u0432\u0435\u0442\");             try {                 execute(builder.build());             } catch (TelegramApiException e) {                 log.debug(e.toString());             }         }          if (messageText.contains(\"\/chartId\")) {             builder.text(\"ID \u041a\u0430\u043d\u0430\u043b\u0430 : \" + chatId);             try {                 execute(builder.build());             } catch (TelegramApiException e) {                 log.debug(e.toString());             }         }     }       public String getBotUsername() {         return config.getBotUserName();     }      public String getBotToken() {         return config.getToken();     } } <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0414\u0430\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 Telegram<\/p>\n<ul>\n<li>\n<p>\u043c\u0435\u0442\u043e\u0434 onUpdateReceived \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u0448\u0435\u0434\u0448\u0438\u0435 \u0432 \u043b\u0438\u0447\u043a\u0443 \u0438\u043b\u0438 \u0432 \u043a\u0430\u043d\u0430\u043b \u0433\u0434\u0435 \u0431\u043e\u0442 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440<\/p>\n<\/li>\n<\/ul>\n<details class=\"spoiler\">\n<summary>WebHook &#8212; RestController \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u044e\u0449\u0438\u0439 API \u0434\u043b\u044f \u0440\u0435\u0430\u043a\u0446\u0438\u0438 \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u044f WebHook Gitea<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"java\">@Slf4j @RestController @RequestMapping(\"\/api\/public\/gitea\") @RequiredArgsConstructor @PropertySource(\"classpath:application.properties\") public class WebHook {     Bot bot;      \/\/ \u041a\u0430\u043d\u0430\u043b \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u043c \u0441\u043b\u0430\u0442\u044c \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f     @Value(\"${chartId}\")     String chartId;      \/\/ \u0421\u0435\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u0434\u0451\u0442 \u0432 \u043d\u0443\u0442\u0440\u0438 JSON \u043e\u0442 Gitea,     \/\/ \u0447\u0442\u043e \u0431\u044b \u043b\u0435\u0432\u044b\u0435 \u043b\u044e\u0434\u0438 \u043d\u0435 \u0438\u043c\u0435\u043b\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0431\u043e\u0442\u0443 \u0442.\u043a. API \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u043e\u0435 \u0431\u0435\u0437 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438     @Value(\"${secret}\")     String secret;      @Autowired     public WebHook(Bot bot) {         this.bot = bot;     }      @PostMapping(value = \"\/webhook\")     public ResponseEntity&lt;?&gt; webhook(@RequestBody String json){         Gson gson = new Gson();         GiteaWebHook giteaWebHook = null;         try {             giteaWebHook = gson.fromJson(json, GiteaWebHook.class);         } catch (JsonSyntaxException e) {             log.error(Utils.exceptionStackTraceToString(e));             return new ResponseEntity&lt;&gt;(Utils.exceptionStackTraceToString(e), HttpStatus.BAD_REQUEST);         }         if (validationWebHookContent(giteaWebHook)) {             SendMessage.SendMessageBuilder messageBuilder =SendMessage.builder();             messageBuilder.chatId(chartId);              messageBuilder.parseMode(ParseMode.HTML);             StringBuilder builder = new StringBuilder();             builder.append(\"&lt;b&gt;\u041f\u0440\u043e\u0435\u043a\u0442&lt;\/b&gt; : \" + giteaWebHook.getRepository().getName()+\"\\n\");             for (Commit commit : giteaWebHook.getCommits()) {              builder.append(\"&lt;b&gt;\u0410\u0432\u0442\u043e\u0440&lt;\/b&gt; : \" + commit.getAuthor().getName()+\"\\n\");              builder.append(\"&lt;b&gt;\u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439&lt;\/b&gt; : \" + commit.getMessage()+\"\\n\");             }             builder.append(\"&lt;a href=\\\"https:\/\/play.google.com\/store\/apps\/details?id=URL_\u0412\u0410\u0428\u0415\u0413\u041e_\u041f\u0420\u0418\u041b\u0410\u0416\u0415\u041d\u0418\u042f\\\"&gt;\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0432 Play Market \u0447\u0435\u0440\u0435\u0437 \u043f\u0430\u0440\u0443 \u043c\u0438\u043d\u0443\u0442&lt;\/a&gt;\\n\");             messageBuilder.text(buildToCorrectString(builder));             try {                 bot.execute(messageBuilder.build());             } catch (TelegramApiException e) {                 log.error(Utils.exceptionStackTraceToString(e));                 return new ResponseEntity&lt;&gt;(Utils.exceptionStackTraceToString(e), HttpStatus.INTERNAL_SERVER_ERROR);             }         } else return new ResponseEntity&lt;&gt;(HttpStatus.BAD_REQUEST);          HttpHeaders headers = new HttpHeaders();         headers.add(\"Content-Type\", \"application\/json; charset=utf-8\");         return new ResponseEntity&lt;&gt;(headers, HttpStatus.OK);     }      \/**      * \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u0440\u0438\u0448\u0435\u0434\u0448\u0438\u0445 JSON \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0432\u0430\u043b\u0438\u0434\u043d\u043e\u0441\u0442\u044c      * @param giteaWebHook - GiteaWebHook      * @return true - \u0435\u0441\u043b\u0438 \u043d\u0435 null, PUSH \u0432 master, \u0441\u043e\u0432\u043f\u0430\u043b \u0441\u0435\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043a\u043b\u044e\u0447      *\/     private boolean validationWebHookContent(GiteaWebHook giteaWebHook){         return giteaWebHook != null &amp;&amp; \/\/ \u0415\u0441\u043b\u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u0447\u0442\u043e \u0442\u043e \u0435\u0441\u0442\u044c                giteaWebHook.getRef().contains(giteaWebHook.getRepository().getDefaultBranch()) &amp;&amp; \/\/ \u0415\u0441\u0442\u044c \u0431\u044b\u043b PUSH \u0432 \/master                giteaWebHook.getSecret().equals(secret); \/\/ \u0415\u0441\u043b\u0438 \u0441\u043e\u0432\u043f\u0430\u043b \u0441\u0435\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043a\u043b\u044e\u0447     }      private String buildToCorrectString(StringBuilder builder){         return builder.toString()                 .replace(\"_\", \"\\\\_\")                 .replace(\"*\", \"\\\\*\")                 .replace(\"[\", \"\\\\[\")                 .replace(\"`\", \"\\\\`\")                 .replace(\"&amp;nbsp;\", \" \")                 .replace(\"&amp;frac\", \" \")                 .replaceAll(\" \\\\u003c\",\"\");     } } <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0414\u0430\u043d\u043d\u044b\u0439 RestController \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u0435\u0442 RestAPI \u0441 \u0442\u043e\u0447\u043a\u043e\u0439 \u0432\u0445\u043e\u0434\u0430 http:\/\/you_ip:port\/api\/public\/gitea\/webhook , \u0441\u044e\u0434\u0430 \u043d\u0430\u0448\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u0432\u0435\u0440\u0441\u0438\u0439 Gitea \u0431\u0443\u0434\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c PUSH \u0437\u0430\u043f\u0440\u043e\u0441 \u0441 JSON \u0434\u0430\u043d\u043d\u044b\u043c\u0438 WebHook \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0449\u0435\u0433\u043e \u043f\u0440\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u044f\u0445 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0441 \u0432\u0430\u0448\u0438\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u0430\u0440\u0438\u0435\u043c.<\/p>\n<details class=\"spoiler\">\n<summary>TelegramBotGiteaApplication &#8212; \u0421\u0442\u0430\u0440\u0442\u043e\u0432\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u043d\u0430\u0448\u0435\u0433\u043e Spring Boot \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"java\">@SpringBootApplication @AutoConfigurationPackage public class TelegramBotGiteaApplication extends SpringBootServletInitializer {      public static void main(String[] args) {         new SpringApplicationBuilder(TelegramBotGiteaApplication.class)                 .run(args);     } }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0412\u0441\u0435 \u0442\u0435 \u043a\u043b\u0430\u0441\u0441\u044b \u0447\u0442\u043e \u0432\u044b \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u0442\u0435 \u0432 \u043f\u0430\u043a\u0435\u0442\u0435 Model , \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c GiteaWebHook \u043f\u043e JSON-Schema \u0432\u0437\u044f\u0442\u043e\u043c\u0443 \u0438\u0437 \u043e\u0444 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043f\u043e <a href=\"https:\/\/docs.gitea.io\/en-us\/webhooks\/\" rel=\"noopener noreferrer nofollow\">GiteaWebHookApi<\/a> , \u0443\u0434\u043e\u0431\u043d\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 <a href=\"http:\/\/www.jsonschema2pojo.org\/\" rel=\"noopener noreferrer nofollow\">http:\/\/www.jsonschema2pojo.org\/<\/a><\/p>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u0437\u044f\u0442\u044c <a href=\"https:\/\/legan.by\/gitea\/leganas\/TelegramBotGiteaLesson\" rel=\"noopener noreferrer nofollow\">\u0417\u0414\u0415\u0421\u042c<\/a><\/p>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Gitea \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f WebHook \u043a \u043d\u0430\u0448\u0435\u043c\u0443 \u0431\u043e\u0442\u0443<\/h3>\n<p>\u0414\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u043d\u0438\u044f API \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u043e\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u0432\u0435\u0440\u0441\u0438\u0439 Gitea \u043d\u043e \u044d\u0442\u043e \u043d\u0435 \u0437\u043d\u0430\u0447\u0438\u0442 \u0447\u0442\u043e \u0432\u044b \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043e\u043f\u043e\u0432\u0435\u0449\u0435\u043d\u0438\u0435 \u0438 \u0431\u0435\u0437 \u043d\u0435\u0451. \u041f\u0440\u043e\u044f\u0432\u0438\u0432 \u043d\u0435\u043a\u0443\u044e \u0434\u043e\u043b\u044e \u0443\u0441\u0435\u0440\u0434\u0438\u044f \u0432\u0441\u0451 \u0442\u0435-\u0436\u0435 WebHook \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 .git\\hooks\\post-update \u0438 curl , \u0438\u043b\u0438 \u043d\u0435\u043a\u043e\u0435 API GitHub \u043d\u043e \u044d\u0442\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u044f \u0434\u043e\u0432\u0435\u0440\u044f\u044e \u0432\u0430\u043c, \u0438 \u0437\u0434\u0435\u0441\u044c \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043b\u0438\u0448\u044c \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0441 Gitea:<\/p>\n<ol>\n<li>\n<p>\u0418\u0442\u0430\u043a, \u043f\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u0430\u0440\u0438\u0439 \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438 \u0432\u043e\u0439\u0434\u0438\u0442\u0435 \u0432 \u0435\u0433\u043e <strong>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 <\/strong>\u0432 \u0440\u0430\u0437\u0434\u0435\u043b <strong>\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435<\/strong> . \u041d\u0430\u0436\u043c\u0438\u0442\u0435 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 <strong>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c Webhook<\/strong> , \u0432\u044b\u0431\u0435\u0440\u0435\u0442\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 Gitea<\/p>\n<\/li>\n<li>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 <strong>URL \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 <\/strong>\u0443\u043a\u0430\u0436\u0438\u0442\u0435 URL \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0443 \u043d\u0430\u0441 \u0432\u0438\u0441\u0438\u0442<strong> <\/strong>RestController http:\/\/you_ip:port\/api\/public\/gitea\/webhook<\/p>\n<\/li>\n<li>\n<p><strong>\u0422\u0438\u043f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e <\/strong>&#8212; application\/json<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0435\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 <\/strong>&#8212; \u043b\u044e\u0431\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0432\u043d\u0435\u0441\u0451\u043c \u0432 \u043d\u0430\u0448<strong> <\/strong>application.properties<\/p>\n<\/li>\n<li>\n<p><strong>\u041d\u0430 \u043a\u0430\u043a\u0438\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u044d\u0442\u043e\u0442 webhook \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c? <\/strong>&#8212; \u0432\u044b\u0431\u0435\u0440\u0438\u0442\u0435 PUSH<\/p>\n<\/li>\n<li>\n<p>\u0413\u0430\u043b\u043e\u0447\u043a\u0443 \u0410\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u043e\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u0432\u043a\u043b\u044e\u0447\u0451\u043d\u043d\u043e\u0439.<\/p>\n<\/li>\n<\/ol>\n<p><strong>\u0412\u0441\u0451 \u044d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u0431\u043e\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d, Gitea \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u043d\u043e \u043d\u0430\u0448\u0435\u043c\u0443 \u0431\u043e\u0442\u0443 \u043d\u0443\u0436\u043d\u043e \u0433\u0434\u0435-\u0442\u043e \u0436\u0438\u0442\u044c. <\/strong><\/p>\n<h2>\u041f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0431\u043e\u0442\u0430 \u0432 Google Cloud Platform, \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e<\/h2>\n<p><strong>New customers get $300 in free credits to spend on Google Cloud. All customers get free usage of 20+ products.&nbsp;<\/strong><a href=\"https:\/\/cloud.google.com\/free\" rel=\"noopener noreferrer nofollow\"><strong><u>See offer details<\/u><\/strong><\/a><strong>.<\/strong><\/p>\n<p>\u0422\u0430\u043a\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u043d\u0430 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u044d\u0442\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u043e\u043d\u0438 \u0434\u0430\u044e\u0442 300$ \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e \u043d\u0430 \u0433\u043e\u0434 \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0443 \u043d\u0438\u0445 \u0432 \u043e\u0431\u043b\u0430\u043a\u0435, \u0438 \u043d\u0430\u043c \u044d\u0442\u043e\u0433\u043e \u0432\u043f\u043e\u043b\u043d\u0435 \u0441\u0435\u0431\u0435 \u0445\u0432\u0430\u0442\u0438\u0442.<\/p>\n<p>\u0418 \u0442\u0430\u043a \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c, \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0443\u0439\u0442\u0435\u0441\u044c \u0432 <a href=\"https:\/\/cloud.google.com\/\" rel=\"noopener noreferrer nofollow\">Google Cloud Platform<\/a><\/p>\n<p>1) \u0412 \u0431\u043e\u043a\u043e\u0432\u043e\u043c \u043c\u0435\u043d\u044e \u043f\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u0432 \u0440\u0430\u0437\u0434\u0435\u043b \u0421ompute Engine, \u0438 \u0434\u043e\u0436\u0434\u0438\u0442\u0435\u0441\u044c \u0435\u0433\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438<\/p>\n<p>2) \u0412 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u042d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b \u0412\u041c, \u043d\u0430\u0436\u043c\u0438\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/4e9\/c7f\/824\/4e9c7f824d4947f06b9098e95526bd98.png\" width=\"1405\" height=\"256\"><figcaption><\/figcaption><\/figure>\n<p>\u0412\u044b\u0431\u0435\u0440\u0435\u0442\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u0430 \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u0432\u043e\u0442 \u0442\u0430\u043a\u0443\u044e, \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043d\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/7d3\/07d\/3d0\/7d307d3d0a81ae3468b4bdc4d3f09039.PNG\" width=\"846\" height=\"904\"><figcaption><\/figcaption><\/figure>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0437\u0430\u0434\u0430\u0434\u0438\u043c \u0441\u0440\u0430\u0437\u0443 \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0411\u0440\u0430\u043d\u0434\u043c\u0430\u0443\u044d\u0440\u0430 \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u044e\u0449\u0435\u0433\u043e \u0442\u0440\u0430\u0444\u0438\u043a \u043f\u043e \u043f\u043e\u0440\u0442\u0443 8080<\/p>\n<p>\u0417\u0430\u0439\u0434\u0438\u0442\u0435 C\u0435\u0442\u044c VPS &#8212; \u0411\u0440\u0430\u043d\u0434\u043c\u0430\u0443\u044d\u0440<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e90\/e85\/b3b\/e90e85b3b3978f2b12e78bb49d6ecf05.PNG\" width=\"1351\" height=\"738\"><figcaption><\/figcaption><\/figure>\n<p>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0434\u043b\u044f \u043f\u043e\u0440\u0442\u0430 8080 \u043f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u0441 80 \u043f\u043e\u0440\u0442\u043e\u043c<\/p>\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u0441\u044c \u043a VM \u0447\u0435\u0440\u0435\u0437 SSH , \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0447\u0435\u0440\u0435\u0437 \u0431\u0440\u0430\u0443\u0437\u0435\u0440 <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/82b\/d87\/364\/82bd873647b81606a47a94d0ced365f5.PNG\" width=\"1245\" height=\"880\"><figcaption><\/figcaption><\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u0442 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 \u043d\u0430\u0448\u0435\u0439 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b<\/p>\n<p>\u0414\u043b\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e\u0431 \u043d\u043e\u0432\u0435\u0439\u0448\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0432\u0432\u043e\u0434\u0438\u043c<\/p>\n<pre><code class=\"bash\">sudo apt update<\/code><\/pre>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c Java<\/p>\n<pre><code class=\"bash\">sudo apt install default-jdk<\/code><\/pre>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u044d\u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0432 <\/p>\n<pre><code class=\"bash\">java - version<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0441\u0451 \u043f\u0440\u043e\u0448\u043b\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0442\u044c \u0432\u0435\u0440\u0441\u0438\u044e Java \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 SSH <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/272\/6fe\/2ca\/2726fe2cadc6f85354cab5e5912f8912.PNG\" width=\"591\" height=\"68\"><figcaption><\/figcaption><\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c maven<\/p>\n<pre><code class=\"bash\">sudo apt install maven<\/code><\/pre>\n<p>\u0421\u0434\u0435\u043b\u0430\u0435\u043c clone \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u0430\u0440\u0438\u044f \u0441 \u043d\u0430\u0448\u0438\u043c \u0431\u043e\u0442\u043e\u043c \u0437\u0430\u0433\u043e\u0442\u043e\u0432\u043a\u043e\u0439<\/p>\n<pre><code class=\"bash\">git clone https:\/\/legan.by\/gitea\/leganas\/TelegramBotGiteaLesson.git<\/code><\/pre>\n<p>\u0421\u0434\u0435\u043b\u0430\u0439\u0442\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u043f\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 appliation.properties , \u0443\u043a\u0430\u0436\u0438\u0442\u0435 \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0439 bot_name \u0438 token <\/p>\n<pre><code class=\"bash\">nano .\/TelegramBotGiteaLesson\/src\/main\/resources\/application.properties<\/code><\/pre>\n<p>\u0417\u0430\u0439\u0434\u0451\u043c \u0432 \u043f\u0430\u043f\u043a\u0443 \u0441 \u043d\u0430\u0448\u0438\u043c \u0431\u043e\u0442\u043e\u043c \u0438 \u0441\u043e\u0431\u0435\u0440\u0451\u043c \u0435\u0433\u043e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 maven<\/p>\n<pre><code class=\"bash\">cd TelegramBotGiteaLesson\/ mvn package<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a maven \u0441\u043e\u0431\u0435\u0440\u0451\u0442 \u043d\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/023\/948\/577\/0239485772d3b2751ca85cb0f44d918b.PNG\" width=\"626\" height=\"143\"><figcaption><\/figcaption><\/figure>\n<p>\u0411\u043e\u0442 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0433\u043e\u0442\u043e\u0432 \u043a \u0437\u0430\u043f\u0443\u0441\u043a\u0443, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <\/p>\n<pre><code class=\"bash\">java -jar .\/target\/telegrambotgitea-0.0.1-SNAPSHOT.jar<\/code><\/pre>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u0439 IP \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 \u0432 web \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043c\u0430\u0448\u0438\u043d\u0430\u043c\u0438, \u043f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c \u043e\u0442\u043a\u0440\u044b\u0432 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 http:\/\/YOU_IP:8080\/<\/p>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0430\u0448 \u0431\u043e\u0442 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043b\u0441\u044f \u043a Telegram \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0435\u043c\u0443 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u0447\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432 \u041b\u0421 \/hello , \u043d\u0430 \u0447\u0442\u043e \u043e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043d\u0430\u043c \u041f\u0440\u0438\u0432\u0435\u0442<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c09\/af2\/07e\/c09af207e85db6aa6fde127bd257acae.PNG\" width=\"682\" height=\"89\"><figcaption><\/figcaption><\/figure>\n<p>\u0418 \u0442\u0430\u043a \u0442\u0435\u043f\u0435\u0440\u044c \u0443 \u043d\u0430\u0441 \u0432\u0441\u0451 \u0433\u043e\u0442\u043e\u0432\u043e \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e \u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0430\u0448\u0435\u0433\u043e \u0431\u043e\u0442\u0430 \u0432 Telegram \u043a\u0430\u043d\u0430\u043b, \u0434\u0430\u0442\u044c \u0435\u043c\u0443 \u043f\u0440\u0430\u0432\u0430 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430 (\u0447\u0442\u043e \u0431\u044b \u043e\u043d \u043c\u043e\u0433 \u0447\u0438\u0442\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f) \u0438 \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u043f\u043e\u0432\u0435\u0449\u0435\u043d\u0438\u0435 !<\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043b \u0431\u043e\u0442\u0430 \u0432 \u043a\u0430\u043d\u0430\u043b \u0438 \u0434\u0430\u0432 \u0435\u043c\u0443 \u043f\u0440\u0430\u0432\u0430 , \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c <\/p>\n<pre><code>\/chartId<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5dd\/ef9\/f15\/5ddef9f154d4286b823c248e4e029703.PNG\" width=\"674\" height=\"85\"><figcaption><\/figcaption><\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u044d\u0442\u043e ID \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 application.properties \u0438 \u043b\u0438\u0431\u043e \u043f\u0435\u0440\u0435\u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 , \u043b\u0438\u0431\u043e \u043f\u043e\u0434\u043a\u0438\u043d\u0443\u0442\u044c \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b \u0440\u044f\u0434\u043e\u043c \u0441 jar. \u0412\u043d\u0435\u0441\u0438\u0442\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043f\u0440\u0430\u0432\u043a\u0438 IP \u0430\u0434\u0440\u0435\u0441\u0430 \u0432 WebHook \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 Gitea \u0438 \u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0432\u0430\u0448\u0435\u0433\u043e \u0431\u043e\u0442\u0430.<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/aed\/9a2\/c10\/aed9a2c10d5aa21906e3bfac753e8006.PNG\" width=\"507\" height=\"348\"><figcaption><\/figcaption><\/figure>\n<p>\u0423 \u043a\u043e\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0432\u043e\u0442 \u0442\u0430\u043a , \u0442\u043e\u0442 \u043c\u043e\u043b\u043e\u0434\u0435\u0446, \u043e \u0442\u043e\u043c \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c jar \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u0443\u0436\u0435 \u043d\u0435 \u0431\u0443\u0434\u0443, \u0443\u0436 \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e \u044d\u0442\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u043d\u0430 \u0445\u0430\u0431\u0440\u0435, \u0430 \u0435\u0441\u043b\u0438 \u043d\u0435 \u043d\u0430\u0439\u0434\u0451\u0442\u0435 \u043f\u0438\u0448\u0438\u0442\u0435 \u0432 \u043b\u0438\u0447\u043a\u0443.<\/p>\n<p>\u041d\u0430\u0434\u0435\u044e\u0441\u044c \u043c\u043e\u0451 \u043f\u043e\u0432\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u0435 \u0431\u044b\u043b\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u044b\u043c, \u0447\u0442\u043e\u0431\u044b \u043b\u044e\u0431\u043e\u0439 \u0441\u043c\u043e\u0433 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441\u0432\u043e\u044e \u0437\u0432\u0435\u0440\u0443\u0448\u043a\u0443. <\/p>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/539564\/\"> https:\/\/habr.com\/ru\/post\/539564\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<p>\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435 \u043a\u0430\u043a \u0438 \u043e\u0431\u0435\u0449\u0430\u043b \u0432 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435 \u043c\u043e\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043e <a href=\"https:\/\/habr.com\/ru\/post\/539400\/\" rel=\"noopener noreferrer nofollow\">\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 Google Play<\/a> , \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u044e \u0432 \u0434\u0435\u0442\u0430\u043b\u044f\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f Telegram Bot`a \u0434\u043b\u044f \u043e\u043f\u043e\u0432\u0435\u0449\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u043e\u0432 \u043e \u0432\u044b\u043f\u0443\u0441\u043a\u0435 \u043d\u043e\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438.<\/p>\n<h2>\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f Bota \u0432 Telegram \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 ID<\/h2>\n<p>\u041f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e&nbsp;<a href=\"https:\/\/tele.gs\/botfather\" rel=\"noopener noreferrer nofollow\">@BotFather<\/a>&nbsp;\u0438&nbsp;\u0441\u043b\u0435\u0434\u0443\u0439\u0442\u0435 \u0435\u0433\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c. <\/p>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b<\/p>\n<pre><code>\/start \/newbot bot_name<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u0412 \u0438\u0442\u043e\u0433\u0435 \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435<\/summary>\n<div class=\"spoiler__content\">\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0418\u0437 \u044d\u0442\u043e\u0433\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e <\/p>\n<ul>\n<li>\n<p>t.me\/bot_name &#8212; \u0418\u043c\u044f \u0431\u043e\u0442\u0430 \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0435\u0433\u043e \u0432 \u043a\u0430\u043d\u0430\u043b\u044b \u0438\u043b\u0438 \u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u041b\u0421<\/p>\n<\/li>\n<li>\n<p>token &#8212; \u044d\u0442\u043e \u043d\u0430\u0448 \u043a\u043b\u044e\u0447 \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a API<\/p>\n<\/li>\n<\/ul>\n<h2>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a<\/h2>\n<p>\u041d\u0430\u0448 \u0431\u043e\u0442 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 Java \u0438 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0438\u0437 \u0441\u0435\u0431\u044f Spring Boot Web \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0441\u0431\u043e\u0440\u043a\u0438 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f maven<\/p>\n<p>1) \u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 Spring Boot \u043f\u0440\u043e\u0435\u043a\u0442, \u043f\u0440\u043e\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0442\u043e\u0440 \u0432 <strong><em>IntelliJ IDEA <\/em><\/strong>, \u043b\u0438\u0431\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f <a href=\"https:\/\/start.spring.io\/\" rel=\"noopener noreferrer nofollow\">Spring Initializr<\/a>. <\/p>\n<p>\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0442\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0435 \u043d\u0443\u0436\u043d\u044b\u043c\u0438, \u043d\u043e \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u043c \u043f\u043e\u0434\u043e\u0439\u0434\u0451\u0442 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440<\/p>\n<details class=\"spoiler\">\n<summary>pom.xml<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"xml\">    &lt;parent&gt;         &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;         &lt;artifactId&gt;spring-boot-starter-parent&lt;\/artifactId&gt;         &lt;version&gt;2.1.6.RELEASE&lt;\/version&gt;         &lt;relativePath\/&gt; &lt;!-- lookup parent from repository --&gt;     &lt;\/parent&gt;      &lt;properties&gt;         &lt;java.version&gt;1.8&lt;\/java.version&gt;     &lt;\/properties&gt;      &lt;dependencies&gt;         &lt;dependency&gt;             &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;             &lt;artifactId&gt;spring-boot-starter-web&lt;\/artifactId&gt;         &lt;\/dependency&gt;          &lt;dependency&gt;             &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;             &lt;artifactId&gt;spring-boot-starter-test&lt;\/artifactId&gt;             &lt;scope&gt;test&lt;\/scope&gt;         &lt;\/dependency&gt;         &lt;dependency&gt;             &lt;groupId&gt;org.telegram&lt;\/groupId&gt;             &lt;artifactId&gt;telegrambots&lt;\/artifactId&gt;             &lt;version&gt;5.0.0&lt;\/version&gt;         &lt;\/dependency&gt;         &lt;dependency&gt;             &lt;groupId&gt;com.google.code.gson&lt;\/groupId&gt;             &lt;artifactId&gt;gson&lt;\/artifactId&gt;             &lt;version&gt;2.8.6&lt;\/version&gt;         &lt;\/dependency&gt;          &lt;dependency&gt;             &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;             &lt;artifactId&gt;spring-boot-configuration-processor&lt;\/artifactId&gt;             &lt;optional&gt;true&lt;\/optional&gt;         &lt;\/dependency&gt;          &lt;dependency&gt;             &lt;groupId&gt;org.projectlombok&lt;\/groupId&gt;             &lt;artifactId&gt;lombok&lt;\/artifactId&gt;             &lt;optional&gt;true&lt;\/optional&gt;         &lt;\/dependency&gt;       &lt;\/dependencies&gt;      &lt;build&gt;         &lt;plugins&gt;             &lt;plugin&gt;                 &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;                 &lt;artifactId&gt;spring-boot-maven-plugin&lt;\/artifactId&gt;             &lt;\/plugin&gt;         &lt;\/plugins&gt;     &lt;\/build&gt; <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 :<\/summary>\n<div class=\"spoiler__content\">\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u0435\u0439 \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u043a\u043b\u0430\u0441\u0441\u0443 : <\/p>\n<details class=\"spoiler\">\n<summary>BotConfig &#8212; \u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u043f\u043e\u0434\u0442\u044f\u0433\u0438\u0432\u0430\u044e\u0449\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0431\u043e\u0442\u0430 \u0438\u0437 application.properties<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"java\">@Configuration @Data @PropertySource(\"classpath:application.properties\") public class BotConfig {      \/\/ \u0418\u043c\u044f \u0431\u043e\u0442\u0430 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438     @Value(\"${botUserName}\")     String botUserName;      \/\/ \u0422\u043e\u043a\u0435\u043d \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438     @Value(\"${token}\")     String token; }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>BotInitializer &#8212; Component \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438\/\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0431\u043e\u0442\u0430 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 Telegram<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"java\">@Component @Slf4j public class BotInitializer {     @Autowired     Bot bot;      @EventListener({ContextRefreshedEvent.class})     public void Init() throws TelegramApiException {         TelegramBotsApi telegramBotsApi = new TelegramBotsApi(DefaultBotSession.class);         try {             telegramBotsApi.registerBot(bot);         } catch (TelegramApiRequestException e) {             log.error(exceptionStackTraceToString(e));         }     } }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0422\u0435\u043b\u0435\u0433\u0440\u0430\u043c API \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0443\u0436\u0435 \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u0434\u043d\u044f\u0442\u0438\u044f \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 Spring, \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u0432\u0435\u0448\u0430\u0435\u043c \u0441\u043b\u0443\u0448\u0430\u0442\u0435\u043b\u044c \u043d\u0430 ContextRefreshedEvent<\/p>\n<details class=\"spoiler\">\n<summary>Bot &#8212; \u0421\u0435\u0440\u0432\u0438\u0441 \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u0432 \u0441\u0435\u0431\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e TelegramLongPollingBot,<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"java\">@Component @Slf4j \/**  * \u041a\u0430\u0441\u0441 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u043f\u0443\u043b\u043e\u043c \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 Telegram  * \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435, \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430, \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439  *\/ public class Bot extends TelegramLongPollingBot {      final     BotConfig config;      public Bot(BotConfig config) {         this.config = config;     }      public void onUpdateReceived(Update update) {         update.getUpdateId();         SendMessage.SendMessageBuilder builder =SendMessage.builder();         String messageText;         String chatId;         if (update.getMessage() != null) {             chatId = update.getMessage().getChatId().toString();             builder.chatId(chatId);             messageText = update.getMessage().getText();         } else {             chatId = update.getChannelPost().getChatId().toString();             builder.chatId(chatId);             messageText = update.getChannelPost().getText();         }          if (messageText.contains(\"\/hello\")) {             builder.text(\"\u041f\u0440\u0438\u0432\u0435\u0442\");             try {                 execute(builder.build());             } catch (TelegramApiException e) {                 log.debug(e.toString());             }         }          if (messageText.contains(\"\/chartId\")) {             builder.text(\"ID \u041a\u0430\u043d\u0430\u043b\u0430 : \" + chatId);             try {                 execute(builder.build());             } catch (TelegramApiException e) {                 log.debug(e.toString());             }         }     }       public String getBotUsername() {         return config.getBotUserName();     }      public String getBotToken() {         return config.getToken();     } } <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0414\u0430\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 Telegram<\/p>\n<ul>\n<li>\n<p>\u043c\u0435\u0442\u043e\u0434 onUpdateReceived \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u0448\u0435\u0434\u0448\u0438\u0435 \u0432 \u043b\u0438\u0447\u043a\u0443 \u0438\u043b\u0438 \u0432 \u043a\u0430\u043d\u0430\u043b \u0433\u0434\u0435 \u0431\u043e\u0442 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440<\/p>\n<\/li>\n<\/ul>\n<details class=\"spoiler\">\n<summary>WebHook &#8212; RestController \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u044e\u0449\u0438\u0439 API \u0434\u043b\u044f \u0440\u0435\u0430\u043a\u0446\u0438\u0438 \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u044f WebHook Gitea<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"java\">@Slf4j @RestController @RequestMapping(\"\/api\/public\/gitea\") @RequiredArgsConstructor @PropertySource(\"classpath:application.properties\") public class WebHook {     Bot bot;      \/\/ \u041a\u0430\u043d\u0430\u043b \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u043c \u0441\u043b\u0430\u0442\u044c \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f     @Value(\"${chartId}\")     String chartId;      \/\/ \u0421\u0435\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u0434\u0451\u0442 \u0432 \u043d\u0443\u0442\u0440\u0438 JSON \u043e\u0442 Gitea,     \/\/ \u0447\u0442\u043e \u0431\u044b \u043b\u0435\u0432\u044b\u0435 \u043b\u044e\u0434\u0438 \u043d\u0435 \u0438\u043c\u0435\u043b\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0431\u043e\u0442\u0443 \u0442.\u043a. API \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u043e\u0435 \u0431\u0435\u0437 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438     @Value(\"${secret}\")     String secret;      @Autowired     public WebHook(Bot bot) {         this.bot = bot;     }      @PostMapping(value = \"\/webhook\")     public ResponseEntity&lt;?&gt; webhook(@RequestBody String json){         Gson gson = new Gson();         GiteaWebHook giteaWebHook = null;         try {             giteaWebHook = gson.fromJson(json, GiteaWebHook.class);         } catch (JsonSyntaxException e) {             log.error(Utils.exceptionStackTraceToString(e));             return new ResponseEntity&lt;&gt;(Utils.exceptionStackTraceToString(e), HttpStatus.BAD_REQUEST);         }         if (validationWebHookContent(giteaWebHook)) {             SendMessage.SendMessageBuilder messageBuilder =SendMessage.builder();             messageBuilder.chatId(chartId);              messageBuilder.parseMode(ParseMode.HTML);             StringBuilder builder = new StringBuilder();             builder.append(\"&lt;b&gt;\u041f\u0440\u043e\u0435\u043a\u0442&lt;\/b&gt; : \" + giteaWebHook.getRepository().getName()+\"\\n\");             for (Commit commit : giteaWebHook.getCommits()) {              builder.append(\"&lt;b&gt;\u0410\u0432\u0442\u043e\u0440&lt;\/b&gt; : \" + commit.getAuthor().getName()+\"\\n\");              builder.append(\"&lt;b&gt;\u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439&lt;\/b&gt; : \" + commit.getMessage()+\"\\n\");             }             builder.append(\"&lt;a href=\\\"https:\/\/play.google.com\/store\/apps\/details?id=URL_\u0412\u0410\u0428\u0415\u0413\u041e_\u041f\u0420\u0418\u041b\u0410\u0416\u0415\u041d\u0418\u042f\\\"&gt;\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0432 Play Market \u0447\u0435\u0440\u0435\u0437 \u043f\u0430\u0440\u0443 \u043c\u0438\u043d\u0443\u0442&lt;\/a&gt;\\n\");             messageBuilder.text(buildToCorrectString(builder));             try {                 bot.execute(messageBuilder.build());             } catch (TelegramApiException e) {                 log.error(Utils.exceptionStackTraceToString(e));                 return new ResponseEntity&lt;&gt;(Utils.exceptionStackTraceToString(e), HttpStatus.INTERNAL_SERVER_ERROR);             }         } else return new ResponseEntity&lt;&gt;(HttpStatus.BAD_REQUEST);          HttpHeaders headers = new HttpHeaders();         headers.add(\"Content-Type\", \"application\/json; charset=utf-8\");         return new ResponseEntity&lt;&gt;(headers, HttpStatus.OK);     }      \/**      * \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u0440\u0438\u0448\u0435\u0434\u0448\u0438\u0445 JSON \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0432\u0430\u043b\u0438\u0434\u043d\u043e\u0441\u0442\u044c      * @param giteaWebHook - GiteaWebHook      * @return true - \u0435\u0441\u043b\u0438 \u043d\u0435 null, PUSH \u0432 master, \u0441\u043e\u0432\u043f\u0430\u043b \u0441\u0435\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043a\u043b\u044e\u0447      *\/     private boolean validationWebHookContent(GiteaWebHook giteaWebHook){         return giteaWebHook != null &amp;&amp; \/\/ \u0415\u0441\u043b\u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u0447\u0442\u043e \u0442\u043e \u0435\u0441\u0442\u044c                giteaWebHook.getRef().contains(giteaWebHook.getRepository().getDefaultBranch()) &amp;&amp; \/\/ \u0415\u0441\u0442\u044c \u0431\u044b\u043b PUSH \u0432 \/master                giteaWebHook.getSecret().equals(secret); \/\/ \u0415\u0441\u043b\u0438 \u0441\u043e\u0432\u043f\u0430\u043b \u0441\u0435\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043a\u043b\u044e\u0447     }      private String buildToCorrectString(StringBuilder builder){         return builder.toString()                 .replace(\"_\", \"\\\\_\")                 .replace(\"*\", \"\\\\*\")                 .replace(\"[\", \"\\\\[\")                 .replace(\"`\", \"\\\\`\")                 .replace(\"&amp;nbsp;\", \" \")                 .replace(\"&amp;frac\", \" \")                 .replaceAll(\" \\\\u003c\",\"\");     } } <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0414\u0430\u043d\u043d\u044b\u0439 RestController \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u0435\u0442 RestAPI \u0441 \u0442\u043e\u0447\u043a\u043e\u0439 \u0432\u0445\u043e\u0434\u0430 http:\/\/you_ip:port\/api\/public\/gitea\/webhook , \u0441\u044e\u0434\u0430 \u043d\u0430\u0448\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u0432\u0435\u0440\u0441\u0438\u0439 Gitea \u0431\u0443\u0434\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c PUSH \u0437\u0430\u043f\u0440\u043e\u0441 \u0441 JSON \u0434\u0430\u043d\u043d\u044b\u043c\u0438 WebHook \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0449\u0435\u0433\u043e \u043f\u0440\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u044f\u0445 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0441 \u0432\u0430\u0448\u0438\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u0430\u0440\u0438\u0435\u043c.<\/p>\n<details class=\"spoiler\">\n<summary>TelegramBotGiteaApplication &#8212; \u0421\u0442\u0430\u0440\u0442\u043e\u0432\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u043d\u0430\u0448\u0435\u0433\u043e Spring Boot \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"java\">@SpringBootApplication @AutoConfigurationPackage public class TelegramBotGiteaApplication extends SpringBootServletInitializer {      public static void main(String[] args) {         new SpringApplicationBuilder(TelegramBotGiteaApplication.class)                 .run(args);     } }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0412\u0441\u0435 \u0442\u0435 \u043a\u043b\u0430\u0441\u0441\u044b \u0447\u0442\u043e \u0432\u044b \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u0442\u0435 \u0432 \u043f\u0430\u043a\u0435\u0442\u0435 Model , \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c GiteaWebHook \u043f\u043e JSON-Schema \u0432\u0437\u044f\u0442\u043e\u043c\u0443 \u0438\u0437 \u043e\u0444 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043f\u043e <a href=\"https:\/\/docs.gitea.io\/en-us\/webhooks\/\" rel=\"noopener noreferrer nofollow\">GiteaWebHookApi<\/a> , \u0443\u0434\u043e\u0431\u043d\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 <a href=\"http:\/\/www.jsonschema2pojo.org\/\" rel=\"noopener noreferrer nofollow\">http:\/\/www.jsonschema2pojo.org\/<\/a><\/p>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439<\/p>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-317068","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/317068","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=317068"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/317068\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=317068"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=317068"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=317068"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}