{"id":313729,"date":"2020-11-25T09:00:42","date_gmt":"2020-11-25T09:00:42","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=313729"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=313729","title":{"rendered":"Telegram-\u0431\u043e\u0442 \u043a\u0430\u043a \u0444\u0438\u0442\u043d\u0435\u0441-\u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u0430\u043d\u0434\u0435\u043c\u0438\u0438"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/zy\/1p\/zx\/zy1pzxlgsyq2znx9kkhdyacmjfg.png\" alt=\"image\"><\/p>\n<p>  \u0421 \u043f\u0440\u0438\u0445\u043e\u0434\u043e\u043c \u043a\u043e\u0440\u043e\u043d\u0430\u0432\u0438\u0440\u0443\u0441\u0430 \u043c\u0438\u0440 \u0441\u043e\u0448\u0435\u043b \u0441 \u0443\u043c\u0430 \u0438 \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u043a\u0443\u0447\u0430 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u043e\u043c\u0435\u043d\u044f\u043b\u0438 \u043d\u0430\u0448\u0443 \u0436\u0438\u0437\u043d\u044c. \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u042d\u043c\u0438\u043b\u044c \u0424\u0440\u043e\u043b\u043e\u0432, \u044f \u0440\u0443\u043a\u043e\u0432\u043e\u0436\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0432 \u0414\u043e\u043c\u041a\u043b\u0438\u043a\u0435 \u0438 \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u043f\u043e\u0434\u0435\u043b\u044e\u0441\u044c \u0441 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044f\u043c\u0438 \u0438\u0441\u0442\u043e\u0440\u0438\u0435\u0439 \u043f\u0440\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0431\u043e\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043c\u043e\u0433 \u043d\u0430\u043c \u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0442\u044f\u0433\u043e\u0442\u0430\u043c\u0438 \u043a\u043e\u0432\u0438\u0434-\u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439. <\/p>\n<p>  \u041d\u0430\u0448\u0430 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f \u2014 \u043e\u0434\u043d\u0430 \u0438\u0437 \u0442\u0435\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0442\u0430\u0440\u0430\u044e\u0442\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0436\u0438\u0437\u043d\u044c \u0441\u0432\u043e\u0438\u0445 \u0441\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a\u043e\u0432 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043a\u043e\u043c\u0444\u043e\u0440\u0442\u043d\u043e\u0439. \u0412 \u043e\u0444\u0438\u0441\u0435 \u0435\u0441\u0442\u044c \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0441\u0451: \u0441\u0442\u043e\u043b\u043e\u0432\u044b\u0435, \u043a\u043e\u0444\u0435\u0439\u043d\u0438, \u043a\u0443\u0447\u0430 \u043c\u0435\u0441\u0442 \u0434\u043b\u044f \u043e\u0442\u0434\u044b\u0445\u0430 \u0438 \u0441\u043f\u043e\u0440\u0442\u0437\u0430\u043b \u0441\u043e \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u043c \u043f\u043e\u0441\u0435\u0449\u0435\u043d\u0438\u0435\u043c. \u0412\u043e\u0442 \u043e \u043d\u0435\u043c \u043c\u044b \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u0438 \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c. \u0412 \u043f\u0435\u0440\u0438\u043e\u0434 \u043f\u0430\u043d\u0434\u0435\u043c\u0438\u0438 \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 \u0431\u044b\u043b\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043b\u044e\u0434\u0435\u0439, \u0435\u0434\u0438\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0432 \u0441\u043f\u043e\u0440\u0442\u0437\u0430\u043b\u0435. \u0411\u044b\u043b\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f, <b>\u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u043c\u0435\u0441\u0442\u0430<\/b>. <\/p>\n<p>  \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u0441\u0451 \u0431\u044b\u043b\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u0438 \u043c\u0435\u0441\u0442 \u0432\u0441\u0435\u043c \u0445\u0432\u0430\u0442\u0430\u043b\u043e, \u043d\u043e \u043f\u043e \u043c\u0435\u0440\u0435 \u0432\u044b\u0445\u043e\u0434\u0430 \u043b\u044e\u0434\u0435\u0439 \u0432 \u043e\u0444\u0438\u0441 \u043c\u0435\u0441\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u043e\u0441\u044c, \u0438 \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0437\u0430\u043b \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u043b\u0430\u0441\u044c \u0432 \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u043f\u043e\u0439\u043c\u0430\u0442\u044c \u043c\u043e\u043c\u0435\u043d\u0442, \u043a\u043e\u0433\u0434\u0430 \u043e\u0441\u0432\u043e\u0431\u043e\u0434\u0438\u0442\u0441\u044f \u043c\u0435\u0441\u0442\u0435\u0447\u043a\u043e. \u041a\u0430\u043a \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0441\u044f, \u043b\u0435\u043d\u044c \u2014 \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u044c \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441\u0430: \u043f\u043e\u0447\u0442\u0438 \u0441\u0440\u0430\u0437\u0443 \u043a\u0430\u043a, \u043d\u0430\u0447\u0430\u043b\u0438\u0441\u044c \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u0438 \u0441 \u0437\u0430\u043f\u0438\u0441\u044c, \u043f\u0440\u0438\u0448\u043b\u0430 \u0432 \u0433\u043e\u043b\u043e\u0432\u0443 \u0438\u0434\u0435\u044f \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0431\u043e\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0437\u0430 \u043c\u0435\u043d\u044f.<br \/>  <a name=\"habracut\"><\/a><\/p>\n<blockquote><p>\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0443\u043d\u043a\u0442\u044b \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043a\u043e\u043c\u0443-\u0442\u043e \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u043c\u0438, \u043d\u043e \u044f \u0438\u0445 \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u0442\u0443\u0442 \u043e\u0441\u0442\u0430\u0432\u043b\u044e \u0434\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441 Telegram-\u0431\u043e\u0442\u043e\u043c \u0432\u043f\u0435\u0440\u0432\u044b\u0435.<\/p><\/blockquote>\n<p>  \u041a\u0430\u043a \u0438 \u0432 \u043b\u044e\u0431\u043e\u043c \u0440\u0435\u0446\u0435\u043f\u0442\u0435, \u043d\u0430\u0447\u043d\u0435\u043c \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u0430 \u0438\u043d\u0433\u0440\u0435\u0434\u0438\u0435\u043d\u0442\u043e\u0432:<\/p>\n<ol>\n<li>\u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0438\u0439 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 (\u0446\u0435\u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441\u0430 \u0440\u0443\u0431\u043b\u0435\u0439 150\/\u043c\u0435\u0441);<\/li>\n<li>\u043a\u043b\u0438\u0435\u043d\u0442 Telegram;<\/li>\n<li>Node js;<\/li>\n<li>\u043b\u044e\u0431\u0430\u044f IDE.<\/li>\n<\/ol>\n<p>  <\/p>\n<h4>\u0428\u0430\u0433 1 (\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u043e\u043a\u0435\u043d)<\/h4>\n<p>  \u0417\u0430\u0445\u043e\u0434\u0438\u043c \u0432 Telegram, \u043f\u0438\u0448\u0435\u043c \u0432 \u043f\u043e\u0438\u0441\u043a\u0435 @botfather, \u0430 \u0434\u0430\u043b\u044c\u0448\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u043c \u0435\u0433\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/pi\/0q\/ev\/pi0qevtigwbpgxuiokzkzryq4bk.png\" width=\"400\"><\/div>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0432\u044b \u0432\u0441\u0451 \u0441\u0434\u0435\u043b\u0430\u043b\u0438, \u0432\u0430\u043c \u0432\u044b\u0434\u0430\u044e\u0442 \u0442\u043e\u043a\u0435\u043d. \u041d\u0430 \u044d\u0442\u043e\u043c Telegram \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043b\u043e\u0436\u0438\u0442\u044c \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u043a\u0443, \u0430 \u0442\u043e\u043a\u0435\u043d \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435.<\/p>\n<h4>\u0428\u0430\u0433 2 (\u0433\u043e\u0442\u043e\u0432\u0438\u043c API)<\/h4>\n<p>  \u042d\u0442\u043e\u0442 \u0448\u0430\u0433 \u044f \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0443, \u0442\u0430\u043a \u043a\u0430\u043a \u0443 \u0432\u0430\u0441 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 API. \u041d\u0435 \u0434\u043e\u043b\u0433\u043e \u0434\u0443\u043c\u0430\u044f, \u044f \u0437\u0430\u0448\u0435\u043b \u043d\u0430 \u0441\u0435\u0440\u0432\u0438\u0441, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u0431\u0440\u043e\u043d\u044c, \u043f\u0440\u043e\u0432\u0435\u043b \u0440\u0435\u0432\u0435\u0440\u0441-\u0438\u043d\u0436\u0438\u043d\u0438\u0440\u0438\u043d\u0433 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u0432\u0441\u0435 \u043d\u0443\u0436\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b API \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u0430 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u0445 \u0441\u043b\u043e\u0442\u043e\u0432 \u0438 \u0438\u0445 \u0431\u0440\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>  \u0412\u0441\u0435\u0433\u043e \u0442\u0440\u0438 \u043c\u0435\u0442\u043e\u0434\u0430:<\/p>\n<ol>\n<li>\u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0442\u043e\u043a\u0435\u043d\u0430 \u043f\u043e \u043b\u043e\u0433\u0438\u043d\u0443 \u0438 \u043f\u0430\u0440\u043e\u043b\u044e (\u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u044b\u0439);<\/li>\n<li>\u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u0441\u043b\u043e\u0442\u043e\u0432 \u043f\u043e \u0434\u0430\u0442\u0435;<\/li>\n<li>\u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u0435\u0441\u0442\u0430.<\/li>\n<\/ol>\n<p>  <\/p>\n<h4>\u0428\u0430\u0433 3 (\u043f\u0438\u0448\u0435\u043c \u0431\u043e\u0442\u0430)<\/h4>\n<p>  \u0415\u0441\u0442\u044c \u043a\u0443\u0447\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0434\u043b\u044f \u0431\u043e\u0442\u043e\u0432. \u042f \u0432\u044b\u0431\u0440\u0430\u043b <a href=\"https:\/\/github.com\/yagop\/node-telegram-bot-api\">\u0432\u043e\u0442 \u0442\u0430\u043a\u0443\u044e<\/a>, \u0443 \u0440\u0435\u0431\u044f\u0442 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u0430\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0438 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435\u0442 \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 issue. <\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0431\u043e\u0442\u0430, \u0442\u0443\u0442 \u0432\u0441\u0451 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e:<\/p>\n<pre><code class=\"javascript\">\/\/ \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0431\u043e\u0442\u0430 const TelegramBot = require('node-telegram-bot-api');  \/\/ \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0438\u043d\u0441\u0442\u0430\u043d\u0441, \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0442\u0443\u0434\u0430 \u0442\u043e\u043a\u0435\u043d \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u044b\u0439 \u0432 \u0441\u0430\u043c\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0435 const bot = new TelegramBot(constants.token, {polling: true});  \/\/ \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u0431\u044b\u0441\u0442\u0440\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b bot.setMyCommands([   {     command: '\/auth',     description: '\u0410\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f. \/auth ${token}'   },   {     command: '\/start',     description: '\u0421\u0442\u0430\u0440\u0442 \u0432\u043e\u0442\u0447\u0435\u0440\u043e\u0432'   },   {     command: '\/list',     description: '\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u043e\u0442\u0447\u0435\u0440\u043e\u0432'   }, ]); <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u044c\u0448\u0435 \u043f\u0440\u043e\u0439\u0434\u0435\u043c\u0441\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e \u0432\u0441\u0435\u043c\u0443 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0443. \u042f \u0445\u043e\u0442\u0435\u043b \u0434\u0430\u0442\u044c \u0441\u0432\u043e\u0438\u043c \u043a\u043e\u043b\u043b\u0435\u0433\u0430\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e \u0431\u043e\u0442\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043e\u0431\u0430\u0432\u0438\u043b, \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u0441\u0430\u043c\u0443\u044e \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u0443\u044e \u0438\u0437 \u0432\u0441\u0435\u0445 \u0438\u043c\u0435\u044e\u0449\u0438\u0445\u0441\u044f \u2014 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e \u0442\u043e\u043a\u0435\u043d\u0443:<\/p>\n<pre><code class=\"javascript\">\/\/ \u0441\u043b\u0443\u0448\u0430\u0435\u043c \u0432\u0432\u043e\u0434 \u043a\u043e\u043c\u0430\u043d\u0434\u044b &quot;\/auth ${token}&quot; bot.onText(\/\\\/auth\/, async (msg) =&gt; {   try {     \/\/ \u041f\u0430\u0440\u0441\u0438\u043c \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435     const token = msg.text.split(' ')[1];     const chatId = msg.chat.id;      \/\/ \u0414\u0430\u043b\u044c\u0448\u0435 \u0435\u0441\u043b\u0438 \u0432\u0441\u0435 \u0432\u0432\u0435\u0434\u0435\u043d\u043e \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0438\u0445 \u0432 \u0444\u0430\u0439\u043b     if (token &amp;&amp; token.length !== 0) {       const tokens = JSON.parse(await fs.readFile('.\/store\/tokens.json', 'utf-8'));              const data = {         ...tokens,         [chatId]: token       };        await fs.writeFile('.\/store\/tokens.json', JSON.stringify(data));        await bot.sendMessage(chatId, 'token registered');     }   } catch (e) {     console.log(e);   } }); <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u044c\u0448\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u043d\u0430\u0448\u0443 \u043a\u043e\u043c\u0430\u043d\u0434\u0443:<\/p>\n<pre><code class=\"javascript\">bot.onText(\/\\\/start\/, async (msg) =&gt; {   try {     const chatId = msg.chat.id;    \/\/ \u0422\u0443\u0442 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043b\u043e\u0442\u043e\u0432 \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0443\u044e \u043d\u0435\u0434\u0435\u043b\u044e (\u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043d\u0438\u0436\u0435)     const days = helpers.getCurrentWeek();      \/\/ \u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u043e\u0435 &quot;\u043a\u0440\u0430\u0441\u0438\u0432\u043e\u0435&quot; \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435     await bot.sendMessage(chatId, '\u041d\u0430 \u043a\u0430\u043a\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u0438\u0435?', {       &quot;reply_markup&quot;: {         &quot;inline_keyboard&quot;: days       },     })      \/\/ \u0423\u0434\u0430\u043b\u044f\u0435\u043c \/start \u0447\u0442\u043e\u0431 \u043d\u0435 \u0431\u044b\u043b\u043e \u043c\u0443\u0441\u043e\u0440\u0430     await bot.deleteMessage(chatId, msg.message_id);   } catch (e) {     console.log(e);   } }); <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u044c\u0448\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0430\u0442\u044b, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c\u0441\u044f:<\/p>\n<pre><code class=\"javascript\">const getCurrentWeek = () =&gt; {   \/\/ \u0420\u0430\u0437\u043c\u0435\u0440, \u0432 \u0446\u0435\u043b\u043e\u043c, \u043d\u0435 \u0432\u0430\u0436\u0435\u043d, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043c\u043e\u043c\u0435\u043d\u0442 \u0438 \u043d\u0435 \u0437\u0430\u043c\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u043c\u0441\u044f   const currentDate = moment();    \/\/ \u0411\u0435\u0440\u0435\u043c \u043d\u0430\u0447\u0430\u043b\u043e \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u043d\u0435\u0434\u0435\u043b\u0438   const weekStart = currentDate.clone().startOf('isoWeek');    const days = [];    \/\/ \u041d\u0443 \u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u0434\u0430\u0442\u044b +- \u043e\u0442 \u043d\u0430\u0447\u0430\u043b\u0430 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u043d\u0435\u0434\u0435\u043b\u0438, \u044d\u0442\u043e \u043f\u043e \u0441\u0432\u043e\u0435\u043c\u0443 \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0435\u043d\u0438\u044e   for (let i = -7; i &lt;= 12; i++) {     const day = moment(weekStart).add(i, 'days');     days.push([{       \/\/ \u042d\u0442\u043e \u0442\u0435\u043a\u0441\u0442 \u0432 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0435       text: day.format(&quot;DD&quot;),             \/\/ \u0412\u043e\u0442 \u044d\u0442\u043e\u0442 \u043a\u0443\u0441\u043e\u043a \u043d\u0443\u0436\u0435\u043d, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u043e\u0442\u0440\u0435\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u043d\u0430\u0436\u0430\u0442\u0438\u0435       \/\/ \u0422\u0430\u043a \u043a\u0430\u043a \u044d\u0442\u043e \u043f\u043e\u043b\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u043a\u0430\u043a \u0441\u0442\u0440\u043e\u043a\u0430, \u0437\u0430\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u043c JSON \u0432 \u0441\u0442\u0440\u043e\u043a\u0443 (\u043b\u0443\u0447\u0448\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u043b)       callback_data: JSON.stringify({         data: day.format('YYYY-MM-DD'),         id: constants.WEEK_DAY       })     }]);   }   return days; } <\/code><\/pre>\n<p>  \u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u0438\u0448\u0435\u043c <code>\/start <\/code>\u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/xd\/pc\/zj\/xdpczj-c6b-akih-x8zpivugphm.png\" width=\"400\"><\/div>\n<p>  \u0414\u0430\u043b\u044c\u0448\u0435 \u043d\u0443\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432\u044b\u0431\u043e\u0440 \u0434\u0430\u0442\u044b, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043a\u043e\u043b\u043b\u0431\u0435\u043a\u043e\u0432:<\/p>\n<pre><code class=\"javascript\">bot.on('callback_query', async (query) =&gt; {   try {    \/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u0441\u0451, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u044f     const {message: {chat, message_id} = {}, data} = query     \/\/ \u0420\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u043c JSON \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u0441\u044e \u043c\u0435\u0442\u0443     const callbackResponse = JSON.parse(data);     \/\/ \u041d\u0430\u0432\u043e\u0434\u0438\u043c \u043a\u0440\u0430\u0441\u043e\u0442\u0443     await bot.deleteMessage(chat.id, message_id);      \/\/ \u041f\u043e \u0432\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044e \u043a\u043e\u043b\u043b\u0431\u0435\u043a\u0430 \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u043c \u0442\u0435\u043b\u043e \u043d\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u044b     if (callbackResponse.id === constants.WEEK_DAY) {       const day = callbackResponse.data;        \/\/ \u0424\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043b\u043e\u0442\u043e\u0432 \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0434\u0435\u043d\u044c. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043d\u0438\u0436\u0435.       await sendEventsList(chat.id, message_id, day);     }   } catch (e) {     console.log(e);   } }); <\/code><\/pre>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0441\u043b\u043e\u0442\u043e\u0432:<\/p>\n<pre><code class=\"javascript\"> const sendEventsList = async (chatId, messageId, day) =&gt; {   try {     \/\/ \u041f\u0440\u043e\u0441\u0442\u043e \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u0435\u0440\u0433\u0430\u0435\u0442 \u043c\u0435\u0442\u043e\u0434 \u043f\u043e \u0442\u043e\u043a\u0435\u043d\u0443 \u0438 \u0434\u0430\u0442\u0435     const eventsList = await api.getEventsTimesList(day);      if (eventsList &amp;&amp; eventsList.length === 0) {       await bot.sendMessage(chatId, '\u041d\u0430 \u044d\u0442\u0443 \u0434\u0430\u0442\u0443 \u043d\u0435\u0442 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u043a');     } else {      \/\/ \u0424\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u0448\u0430\u0431\u043b\u043e\u043d \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u043a \u043d\u0430 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u0443\u044e \u0434\u0430\u0442\u0443       const keyboardList = eventsList.map((listItem) =&gt; ([{         text: `${listItem.time} \u041c\u0435\u0441\u0442: ${listItem.free}`,         callback_data: JSON.stringify({           day,           data: listItem.time,           id: constants.EVENTS_LIST         })       }]));        \/\/ \u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e       await bot.sendMessage(chatId, '\u0417\u0430 \u043a\u0430\u043a\u0438\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u0441\u043b\u0435\u0434\u0438\u0442\u044c?', {         &quot;reply_markup&quot;: {           &quot;inline_keyboard&quot;: keyboardList         },       })     }   } catch (e) {     console.log(e);   } }; <\/code><\/pre>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u043e\u0442 \u0442\u0430\u043a\u0443\u044e \u043a\u0440\u0430\u0441\u043e\u0442\u0443:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/e2\/z0\/yc\/e2z0ycsawsbfypebsarnokacauw.png\" width=\"400\"><\/div>\n<p>  \u041f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u043e\u043c\u0430\u0442\u044c \u0433\u043e\u043b\u043e\u0432\u0443 \u043f\u0440\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0434\u0435\u0440\u0435\u0432\u0430 \u0432\u043e\u0442\u0447\u0435\u0440\u043e\u0432, \u0442\u0430\u043a \u043a\u0430\u043a \u0437\u0430 \u043d\u0438\u043c\u0438 \u043d\u0443\u0436\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u0441\u043b\u0435\u0434\u0438\u0442\u044c, \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u0441\u0442\u0430\u0440\u044b\u0435, \u043d\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0435, \u043f\u0440\u0438\u0432\u044f\u0437\u044b\u0432\u0430\u0442\u044c \u0438\u0445 \u043a \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0443 \u0438 \u0442. \u0434.<\/p>\n<p>  \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0432\u044b\u0431\u043e\u0440 \u0434\u0430\u0442\u044b:<\/p>\n<pre><code class=\"javascript\">bot.on('callback_query', async (query) =&gt; {   try {     const {message: {chat, message_id} = {}, data} = query     const callbackResponse = JSON.parse(data);      await bot.deleteMessage(chat.id, message_id);      const watchers = await fs.readFile('.\/store\/meta.json', 'utf-8');      if (callbackResponse.id === constants.EVENTS_LIST) {      \/\/ \u0422\u0443\u0442, \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u0430\u043c\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435      \/\/ \u041c\u044b \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c \u043d\u043e\u0432\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e       const eventsWatchers = merge(         JSON.parse(watchers),         {           [chat.id]: {             [callbackResponse.day]: {               [callbackResponse.data]: true             }           }         }       );        \/\/ \u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u0444\u0430\u0439\u043b \u043c\u0435\u0442\u044b       await fs.writeFile('.\/store\/meta.json', JSON.stringify(eventsWatchers));        \/\/ \u0421\u0440\u0430\u0437\u0443 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438       \/\/ \u041f\u043e \u0441\u0443\u0442\u0438, \u0432\u0441\u0451, \u0447\u0442\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0430\u043b\u044c\u0448\u0435, \u044d\u0442\u043e \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u0434\u0435\u0440\u0433\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434       checkEvents(eventsWatchers);     }   } catch (e) {     console.log(e);   } }); <\/code><\/pre>\n<p>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043c\u0435\u0442\u043e\u0434 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u043c\u0435\u0441\u0442:<\/p>\n<pre><code class=\"javascript\">const checkEvents = async (eventsWatchers) =&gt; {   \/\/ \u0412\u043e\u0442\u0447\u0435\u0440\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442\u0441\u044f \u0442\u0430\u043a   \/\/ const watchers = await fs.readFile('.\/store\/meta.json');   const chats = Object.keys(eventsWatchers);    \/\/ \u0422\u0443\u0442 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u0430\u0442 \u0438 \u0441\u043b\u043e\u0442\u043e\u0432 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0434\u0430\u0442\u044b, \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u0435\u0441\u0442\u044c   const activeDays = helpers.getActiveDays(eventsWatchers);    \/\/ \u0411\u0435\u0440\u0435\u043c \u043a\u0430\u0436\u0434\u0443\u044e \u0434\u0430\u0442\u0443   Object.keys(activeDays).forEach(async (day) =&gt; {          \/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u0441\u043b\u043e\u0442\u043e\u0432 \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0434\u0430\u0442\u044b     const times = activeDays[day];      \/\/ \u041f\u0440\u043e\u0445\u043e\u0434\u0438\u043c\u0441\u044f \u043f\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c     chats.forEach(async (chat) =&gt; {        \/\/ \u0417\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043b\u043e\u0442\u043e\u0432 \u0434\u043b\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0434\u0430\u0442\u044b       const eventsList = await api.getEventsTimesList(day);               if (eventsList) {         eventsList.forEach(async (event) =&gt; {           \/\/ \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0435\u0441\u0442\u044c \u043b\u0438 \u0441\u043b\u043e\u0442\u044b \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f           if (times.indexOf(event.time) !== -1 &amp;&amp; event.free !== 0) {               try {                 \/\/ \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0435\u0441\u0442\u044c \u043b\u0438 \u0432 \u044d\u0442\u0443 \u0434\u0430\u0442\u0443 \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0438 \u043d\u0430 \u0441\u043b\u043e\u0442                 if (eventsWatchers[chat][day]) {                   const chatTimes = Object.keys(eventsWatchers[chat][day]);                    \/\/ \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d \u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u044d\u0442\u043e\u0442 \u0441\u043b\u043e\u0442                   if (chatTimes.indexOf(event.time) !== -1) {                     const tokens = JSON.parse(await fs.readFile('.\/store\/tokens.json', 'utf-8'));                     \/\/ \u0411\u0435\u0440\u0435\u043c \u0442\u043e\u043a\u0435\u043d \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f                     const token = tokens[chat];                     \/\/ \u0411\u0443\u043a\u0430\u0435\u043c \u0441\u043b\u043e\u0442                     const resp = await api.bookEvent(event.bookId, token)                     \/\/ \u0423\u0434\u0430\u043b\u044f\u0435\u043c \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0443 \u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f                     helpers.deleteWatcher(event.time, day, chat);                     \/\/ \u0413\u043e\u0432\u043e\u0440\u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e, \u0447\u0442\u043e \u043e\u043d \u0437\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043a\u0443                     bot.sendMessage(chat, `\u0412\u044b \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u043d\u0430 ${day} ${event.time}`);                   }                 }               }catch (e) {                 console.log('Book error', e);                 bot.sendMessage(chat, `\u041e\u0448\u0438\u0431\u043a\u0430 \u0437\u0430\u043f\u0438\u0441\u0438. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0442\u043e\u043a\u0435\u043d`);               }           }         });       }     })   }) } <\/code><\/pre>\n<p>  \u042f \u043d\u0435 \u043f\u0440\u0435\u0442\u0435\u043d\u0434\u0443\u044e \u043d\u0430 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043d\u043e \u043e\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e \u0438 \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442 \u043a\u0443\u0447\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0422\u0443\u0442 \u0435\u0441\u0442\u044c \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0435 \u043f\u043e\u043b\u0435 \u0434\u043b\u044f \u0444\u0430\u043d\u0442\u0430\u0437\u0438\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0442\u0435\u043a\u0443\u0449\u0438\u0445 \u043f\u043e\u0434\u043f\u0438\u0441\u043e\u043a \u0441 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0438 \u0442. \u0434. \u041f\u0440\u0438\u043d\u0446\u0438\u043f \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435.<\/p>\n<h4>\u0428\u0430\u0433 4 (\u0441\u0435\u0440\u0432\u0435\u0440)<\/h4>\n<p>  \u0414\u043b\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u044f \u0430\u0440\u0435\u043d\u0434\u043e\u0432\u0430\u043b \u0441\u0430\u043c\u044b\u0439 \u0434\u0435\u0448\u0435\u0432\u044b\u0439 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440. \u041f\u043e\u0441\u0442\u0430\u0432\u0438\u043b \u0442\u0443\u0434\u0430 NodeJS (\u043a\u0430\u043a \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u0432 \u0441\u0435\u0442\u0438 \u043f\u043e\u043b\u043d\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438). \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0434\u0435\u043c\u043e\u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b <a href=\"https:\/\/github.com\/Unitech\/pm2\">PM2<\/a>, \u043e\u043d \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0442\u0430\u0432\u0438\u0442\u0441\u044f \u0438 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f. \u0414\u0430\u043b\u044c\u0448\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b <code>pm2 start index.js<\/code> (\u043f\u0440\u0438\u043c\u0435\u0440), \u0438 \u0432\u0441\u0451 \u0433\u043e\u0442\u043e\u0432\u043e. \u041b\u043e\u0433\u0438 \u0435\u0441\u0442\u044c, \u0434\u0435\u043c\u043e\u043d \u0435\u0441\u0442\u044c, \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0430\u043f\u0442\u0430\u0439\u043c \u043e\u043a\u043e\u043b\u043e \u0434\u0432\u0443\u0445 \u043c\u0435\u0441\u044f\u0446\u0435\u0432.<\/p>\n<h4>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u0427\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u0432\u0441\u0451 \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u043e\u043a\u043e\u043f\u0430\u0442\u044c\u0441\u044f \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430\u0445. \u042f \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u043b\u0441\u044f \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0432\u0441\u0451 \u0441\u0430\u043c\u043e\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0434\u043b\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043b\u044e\u0431\u043e\u0433\u043e \u0431\u043e\u0442\u0430. \u041c\u043e\u0439 \u0431\u043e\u0442 \u0434\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 \u0438\u0441\u043f\u0440\u0430\u0432\u043d\u043e \u0441\u043b\u0443\u0436\u0438\u0442, \u043f\u0440\u0430\u0432\u0434\u0430, \u0432 \u0441\u0432\u044f\u0437\u0438 \u0441 \u043d\u043e\u0432\u043e\u0439 \u0432\u043e\u043b\u043d\u043e\u0439 \u043f\u0430\u043d\u0434\u0435\u043c\u0438\u0438 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u044c \u0432 \u043d\u0435\u043c \u043e\u0442\u043f\u0430\u043b\u0430. \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435.<\/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\/company\/domclick\/blog\/529440\/\"> https:\/\/habr.com\/ru\/company\/domclick\/blog\/529440\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/zy\/1p\/zx\/zy1pzxlgsyq2znx9kkhdyacmjfg.png\" alt=\"image\"><\/p>\n<p>  \u0421 \u043f\u0440\u0438\u0445\u043e\u0434\u043e\u043c \u043a\u043e\u0440\u043e\u043d\u0430\u0432\u0438\u0440\u0443\u0441\u0430 \u043c\u0438\u0440 \u0441\u043e\u0448\u0435\u043b \u0441 \u0443\u043c\u0430 \u0438 \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u043a\u0443\u0447\u0430 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u043e\u043c\u0435\u043d\u044f\u043b\u0438 \u043d\u0430\u0448\u0443 \u0436\u0438\u0437\u043d\u044c. \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u042d\u043c\u0438\u043b\u044c \u0424\u0440\u043e\u043b\u043e\u0432, \u044f \u0440\u0443\u043a\u043e\u0432\u043e\u0436\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0432 \u0414\u043e\u043c\u041a\u043b\u0438\u043a\u0435 \u0438 \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u043f\u043e\u0434\u0435\u043b\u044e\u0441\u044c \u0441 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044f\u043c\u0438 \u0438\u0441\u0442\u043e\u0440\u0438\u0435\u0439 \u043f\u0440\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0431\u043e\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043c\u043e\u0433 \u043d\u0430\u043c \u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0442\u044f\u0433\u043e\u0442\u0430\u043c\u0438 \u043a\u043e\u0432\u0438\u0434-\u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439. <\/p>\n<p>  \u041d\u0430\u0448\u0430 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f \u2014 \u043e\u0434\u043d\u0430 \u0438\u0437 \u0442\u0435\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0442\u0430\u0440\u0430\u044e\u0442\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0436\u0438\u0437\u043d\u044c \u0441\u0432\u043e\u0438\u0445 \u0441\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a\u043e\u0432 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043a\u043e\u043c\u0444\u043e\u0440\u0442\u043d\u043e\u0439. \u0412 \u043e\u0444\u0438\u0441\u0435 \u0435\u0441\u0442\u044c \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0441\u0451: \u0441\u0442\u043e\u043b\u043e\u0432\u044b\u0435, \u043a\u043e\u0444\u0435\u0439\u043d\u0438, \u043a\u0443\u0447\u0430 \u043c\u0435\u0441\u0442 \u0434\u043b\u044f \u043e\u0442\u0434\u044b\u0445\u0430 \u0438 \u0441\u043f\u043e\u0440\u0442\u0437\u0430\u043b \u0441\u043e \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u043c \u043f\u043e\u0441\u0435\u0449\u0435\u043d\u0438\u0435\u043c. \u0412\u043e\u0442 \u043e \u043d\u0435\u043c \u043c\u044b \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u0438 \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c. \u0412 \u043f\u0435\u0440\u0438\u043e\u0434 \u043f\u0430\u043d\u0434\u0435\u043c\u0438\u0438 \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 \u0431\u044b\u043b\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043b\u044e\u0434\u0435\u0439, \u0435\u0434\u0438\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0432 \u0441\u043f\u043e\u0440\u0442\u0437\u0430\u043b\u0435. \u0411\u044b\u043b\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f, <b>\u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u043c\u0435\u0441\u0442\u0430<\/b>. <\/p>\n<p>  \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u0441\u0451 \u0431\u044b\u043b\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u0438 \u043c\u0435\u0441\u0442 \u0432\u0441\u0435\u043c \u0445\u0432\u0430\u0442\u0430\u043b\u043e, \u043d\u043e \u043f\u043e \u043c\u0435\u0440\u0435 \u0432\u044b\u0445\u043e\u0434\u0430 \u043b\u044e\u0434\u0435\u0439 \u0432 \u043e\u0444\u0438\u0441 \u043c\u0435\u0441\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u043e\u0441\u044c, \u0438 \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0437\u0430\u043b \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u043b\u0430\u0441\u044c \u0432 \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u043f\u043e\u0439\u043c\u0430\u0442\u044c \u043c\u043e\u043c\u0435\u043d\u0442, \u043a\u043e\u0433\u0434\u0430 \u043e\u0441\u0432\u043e\u0431\u043e\u0434\u0438\u0442\u0441\u044f \u043c\u0435\u0441\u0442\u0435\u0447\u043a\u043e. \u041a\u0430\u043a \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0441\u044f, \u043b\u0435\u043d\u044c \u2014 \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u044c \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441\u0430: \u043f\u043e\u0447\u0442\u0438 \u0441\u0440\u0430\u0437\u0443 \u043a\u0430\u043a, \u043d\u0430\u0447\u0430\u043b\u0438\u0441\u044c \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u0438 \u0441 \u0437\u0430\u043f\u0438\u0441\u044c, \u043f\u0440\u0438\u0448\u043b\u0430 \u0432 \u0433\u043e\u043b\u043e\u0432\u0443 \u0438\u0434\u0435\u044f \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0431\u043e\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0437\u0430 \u043c\u0435\u043d\u044f.  <\/p>\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-313729","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/313729","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=313729"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/313729\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=313729"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=313729"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=313729"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}