{"id":371713,"date":"2024-05-21T04:55:07","date_gmt":"2024-05-21T04:55:07","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=371713"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=371713","title":{"rendered":"<span>\u0421\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0433\u0430\u0439\u0434 \u043f\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0431\u043e\u0442\u0430 \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0432 Telegram<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/fa\/yu\/v8\/fayuv8envtjvvy5ugnukde0ylhs.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/fa\/yu\/v8\/fayuv8envtjvvy5ugnukde0ylhs.jpeg\" data-blurred=\"true\"\/><\/div>\n<p>  \u0415\u0441\u0442\u044c Telegram-\u043a\u0430\u043d\u0430\u043b\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u044e\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0432 \u043c\u0438\u0440\u0435. \u0410 \u043c\u044b \u0441\u043b\u0435\u0434\u0438\u043c \u0437\u0430 \u0438\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u043c\u0438, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0443\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043d\u0438\u0447\u0435\u0433\u043e \u0432\u0430\u0436\u043d\u043e\u0433\u043e. \u0415\u0441\u043b\u0438 \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u0440\u0443\u0447\u043d\u0443\u044e, \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043d\u0438\u043c\u0430\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0438 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u043a\u043e\u043d\u0446\u0435\u043d\u0442\u0440\u0430\u0446\u0438\u0438 \u043e\u0442 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430. \u0427\u0442\u043e\u0431\u044b \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443, \u043d\u0430\u0448 \u043f\u0430\u0440\u0442\u043d\u0435\u0440 \u0438 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0412\u043b\u0430\u0434\u0438\u043b\u0435\u043d \u041c\u0438\u043d\u0438\u043d \u0441\u043e\u0437\u0434\u0430\u043b Telegram-\u0431\u043e\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438 \u0432\u044b\u0434\u0430\u0435\u0442 \u0440\u0435\u0437\u044e\u043c\u0435 \u043f\u043e \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438.<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c, \u043a\u0430\u043a \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0431\u043e\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0438\u0437 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u0438 \u0437\u0430\u0434\u0435\u043f\u043b\u043e\u0438\u0442\u044c \u0435\u0433\u043e \u043d\u0430 <a href=\"https:\/\/selectel.ru\/services\/cloud\/servers\/?utm_source=habr.com&amp;utm_medium=referral&amp;utm_campaign=cloud_article_bot_250324_content\">\u043e\u0431\u043b\u0430\u0447\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440<\/a>.<a name=\"habracut\"><\/a><\/p>\n<p>  <b>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044e, \u0435\u0441\u043b\u0438 \u043d\u0435 \u0445\u043e\u0442\u0438\u0442\u0435 \u0447\u0438\u0442\u0430\u0442\u044c \u0442\u0435\u043a\u0441\u0442 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e:<\/b><\/p>\n<p>  \u2192 <a href=\"#1\">\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/a><br \/>  \u2192 <a href=\"#2\">\u0410\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f<\/a><br \/>  \u2192 <a href=\"#3\">\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430<\/a><br \/>  \u2192 <a href=\"#4\">\u041f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c<\/a><br \/>  \u2192 <a href=\"#5\">\u0414\u0435\u043f\u043b\u043e\u0439<\/a><\/p>\n<p>  <a name=\"1\"><\/a><font color=\"#EB4247\"><\/p>\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p><\/font><br \/>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0431\u043e\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043a\u0440\u0438\u043f\u0442\u043e\u0432\u0430\u043b\u044e\u0442:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/9e4\/1fb\/a88\/9e41fba887c896bccdc2a04c614fd4cc.png\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/9e4\/1fb\/a88\/9e41fba887c896bccdc2a04c614fd4cc.png\"\/><\/div>\n<blockquote><p>\/sum \u2014 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a \u0431\u043e\u0442\u0443, whale_alert_io \u2014 ID \u043a\u0430\u043d\u0430\u043b\u0430 (\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043b\u044e\u0431\u043e\u0439), \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u0442\u0435\u043a\u0441\u0442 \u2014 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0434\u043b\u044f \u0440\u043e\u0431\u043e\u0442\u0430.<\/p><\/blockquote>\n<p>  <a href=\"https:\/\/selectel.ru\/services\/cloud\/servers\/?utm_source=habr.com&amp;utm_medium=referral&amp;utm_campaign=cloud_article_bot_250324_banner_001_ord\"><\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/nb\/lo\/t_\/nblot_ve1t3hcw5bluwc_-did08.png\" data-src=\"https:\/\/habrastorage.org\/webt\/nb\/lo\/t_\/nblot_ve1t3hcw5bluwc_-did08.png\"\/><\/div>\n<p><\/a><\/p>\n<p>  <a name=\"2\"><\/a><font color=\"#EB4247\"><\/p>\n<h2>\u0410\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f<\/h2>\n<p><\/font><br \/>  \u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u043d\u0443\u0436\u043d\u043e \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0430\u043a\u043a\u0430\u0443\u043d\u0442, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u043c \u0431\u043e\u0442\u0430. \u0427\u0435\u0440\u0435\u0437 \u0431\u043e\u0442\u0430 \u0442\u0430\u043a\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/www.npmjs.com\/package\/telegram\">\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 GramJS<\/a>.<\/p>\n<p>  \u0417\u0430\u0445\u043e\u0434\u0438\u043c \u043d\u0430 <a href=\"https:\/\/my.telegram.org\/\">my.telegram.org<\/a>, \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c API development tools \u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/759\/d88\/a33\/759d88a334f9ec39c7aa190db667cd37.png\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/759\/d88\/a33\/759d88a334f9ec39c7aa190db667cd37.png\"\/><\/div>\n<p>  \u0412 \u043e\u0442\u0432\u0435\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b apiId \u0438 apiHash. \u041f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043a\u043e\u0434 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438:<\/p>\n<pre><code class=\"javascript\">const { TelegramClient } = require('telegram') const input = require('input') const { StringSession } = require('telegram\/sessions') const session = new StringSession('') const apiId = 123 \/\/ \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 Telegram const apiHash = 'abc' \/\/ \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 Telegram ;(async () => {   console.log('Loading interactive example...')   const client = new TelegramClient(session, apiId, apiHash, {     connectionRetries: 5,   })   await client.start({     phoneNumber: async () => await input.text('Please enter your number: '),     password: async () => await input.text('Please enter your password: '),     phoneCode: async () =>       await input.text('Please enter the code you received: '),     onError: (err) => console.log(err),   })   console.log('You should now be connected.')   console.log(client.session.save()) \/\/ \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u0442\u0440\u043e\u0447\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c })() <\/code><\/pre>\n<p>  \u041a\u043e\u043d\u0441\u043e\u043b\u044c \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u0442 \u043d\u043e\u043c\u0435\u0440 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430, \u043f\u0430\u0440\u043e\u043b\u044c \u0438 \u043a\u043e\u0434 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f \u2014 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u0441\u0435\u0441\u0441\u0438\u0438. \u0415\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/13a\/407\/4d6\/13a4074d6b0e7016358e12cc924df16f.png\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/13a\/407\/4d6\/13a4074d6b0e7016358e12cc924df16f.png\"\/><\/div>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/28e\/c83\/259\/28ec832591c7eccf72453deb29cf466d.png\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/28e\/c83\/259\/28ec832591c7eccf72453deb29cf466d.png\"\/><\/div>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043d\u0430 Node.js \u0444\u0443\u043d\u043a\u0446\u0438\u044e node auth, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u043b\u044e\u0447 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438 \u043a Telegram.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/2b6\/062\/118\/2b60621185a695ed25043c1aa0001ac6.png\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/2b6\/062\/118\/2b60621185a695ed25043c1aa0001ac6.png\"\/><\/div>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/yq\/u9\/1q\/yqu91ql5iodqhxwpr_1bo0jw0ti.png\" width=\"85\" align=\"left\" data-src=\"https:\/\/habrastorage.org\/webt\/yq\/u9\/1q\/yqu91ql5iodqhxwpr_1bo0jw0ti.png\"\/><b>\u041b\u044e\u0431\u0438\u0442\u0435 \u0434\u0435\u0442\u0435\u043a\u0442\u0438\u0432\u044b? \u041f\u0440\u043e\u0439\u0434\u0438\u0442\u0435 \u043a\u0432\u0435\u0441\u0442 \u00ab\u0412 \u043f\u043e\u0438\u0441\u043a\u0430\u0445 \u043f\u0440\u043e\u043f\u0430\u0432\u0448\u0438\u0445 \u0441\u0441\u044b\u043b\u043e\u043a\u00bb!<\/b> \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0439\u0442\u0435\u0441\u044c <a href=\"https:\/\/promo.selectel.ru\/quest\/?utm_source=habr.com&amp;utm_medium=referral&amp;utm_campaign=quest_article_maxpromo_230324_banner\">\u043d\u0430 \u0441\u0430\u0439\u0442\u0435<\/a> \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0441\u0435\u0431\u044f \u0432 \u0440\u043e\u043b\u0438 \u0441\u044b\u0449\u0438\u043a\u0430: \u043d\u0430\u0439\u0434\u0438\u0442\u0435 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\u0445 Selectel \u0441\u043f\u0440\u044f\u0442\u0430\u043d\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u0438 \u043f\u0435\u0440\u0432\u044b\u043c\u0438 \u0434\u043e\u0439\u0434\u0438\u0442\u0435 \u0434\u043e \u0444\u0438\u043d\u0430\u043b\u0430. \u0412\u044b\u0438\u0433\u0440\u0430\u0439\u0442\u0435 \u044d\u043a\u0441\u043a\u043b\u044e\u0437\u0438\u0432\u043d\u044b\u0439 \u043c\u0435\u0440\u0447 \u0438 \u043f\u0440\u043e\u043c\u043e\u043a\u043e\u0434 \u043d\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u044b Selectel.  <\/p>\n<p>  <a name=\"3\"><\/a><font color=\"#EB4247\"><\/p>\n<h2>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430<\/h2>\n<p><\/font><br \/>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 Telegram-\u0431\u043e\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u043e\u0438\u0441\u043a\u0430 \u043d\u0435\u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043d\u043d\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c client \u0441 \u0443\u0436\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043d\u043e\u0439 \u0441\u0435\u0441\u0441\u0435\u0439. \u041f\u043e\u0441\u043b\u0435 \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043c\u0435\u0442\u043e\u0434 getUnreadMessages:<\/p>\n<pre><code class=\"javascript\">const { TelegramClient } = require('telegram') const { NewMessage } = require('telegram\/events') const { session, apiId, apiHash} = require('.\/config') const client = new TelegramClient(session, apiId, apiHash, {}) async function getUnreadMessages(channelId, limit = 10) {   const dialogs = await client.getDialogs({}) \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u0441\u0435 \u0447\u0430\u0442\u044b   const channel = dialogs.find((d) => d.entity.username === channelId) \/\/ \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u043d\u0443\u0436\u043d\u044b\u0439 \u043f\u043e ID   if (channel) { \/\/ \u0435\u0441\u043b\u0438 \u043a\u0430\u043d\u0430\u043b \u043d\u0430\u0439\u0434\u0435\u0442     const messages = await client.getMessages(channel.entity, { \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439       \/\/ limit: channel.unreadCount, \/\/ \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0447\u0435\u0441\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043d\u0435\u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043d\u043d\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439       limit, \/\/ \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c     })           console.log(messages.map((m) => m.message).join(' ')) \/\/ \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c   } else {     console.log('\u041a\u0430\u043d\u0430\u043b \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d')   } } ;(async function run() {   \/\/ const channel = 'whale_alert_io'   \/\/ watchNewMessages(channel) \/\/ \u0432\u0430\u0436\u043d\u043e, \u0447\u0442\u043e\u0431 \u043c\u0435\u0442\u043e\u0434 \u0431\u044b\u043b \u0434\u043e client.connect   await client.connect()   await getUnreadMessages(channelId, 10) })() <\/code><\/pre>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0431\u043e\u0442 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043b \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043d\u043d\u044b\u0435, \u043d\u043e \u0438 \u043d\u043e\u0432\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0432 \u0447\u0430\u0442\u0430\u0445, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 watchNewMessages:<\/p>\n<pre><code class=\"javascript\">function watchNewMessages(channelId) {   client.addEventHandler((event) => {     console.log('new message', event.message.message)   }, new NewMessage({ fromUsers: [channelId] })) } <\/code><\/pre>\n<p>  <a name=\"4\"><\/a><font color=\"#EB4247\"><\/p>\n<h2>\u041f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c<\/h2>\n<p><\/font><br \/>  \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c GPT-\u043c\u043e\u0434\u0435\u043b\u044c <a href=\"https:\/\/developers.sber.ru\/gigachat\/\">GigaChat<\/a>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e \u0434\u043e 1 \u043c\u043b\u043d \u0442\u043e\u043a\u0435\u043d\u043e\u0432. \u0427\u0442\u043e\u0431\u044b \u043d\u0430\u0447\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 API, \u043d\u0443\u0436\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f ClientID \u0438 ClientSecret.<\/p>\n<p>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c\u0441\u044f \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 <a href=\"https:\/\/developers.sber.ru\/studio\/workspaces\/8a7b13d6-3c5f-4aaf-a3c7-22e1d873a865\/gigachat-api\/projects\/881aeae5-73ca-4d48-ae3a-7cbc5eff6b20\/parameters\">GigaChat API<\/a> \u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 Client ID \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0438\u0437 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u043f\u043e\u043b\u044f \u0432 \u043f\u0430\u043d\u0435\u043b\u0438 \u0441\u043f\u0440\u0430\u0432\u0430.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/884\/9f7\/163\/8849f716315c637dc6a27bb65e47727e.png\" width=\"450\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/884\/9f7\/163\/8849f716315c637dc6a27bb65e47727e.png\"\/><\/div>\n<p>  <i>\u041f\u043e\u043b\u0435 Client ID. <a href=\"https:\/\/developers.sber.ru\/docs\/ru\/gigachat\/individuals-quickstart#shag-1-sozdayte-proekt-giga-chat-api\">\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a<\/a>.<\/i><\/p>\n<p>  \u0418 \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c <b>\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c Client Secret<\/b>, \u0447\u0442\u043e\u0431\u044b \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u0441\u0435\u043a\u0440\u0435\u0442.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/fcc\/51d\/62e\/fcc51d62ea6a1fb141889e6a0018c316.png\" width=\"450\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/fcc\/51d\/62e\/fcc51d62ea6a1fb141889e6a0018c316.png\"\/><\/div>\n<p>  <i>\u041e\u043a\u043d\u043e \u0441 Client Secret. <a href=\"https:\/\/developers.sber.ru\/docs\/ru\/gigachat\/individuals-quickstart#shag-1-sozdayte-proekt-giga-chat-api\">\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a<\/a>.<\/i><\/p>\n<p>  \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0440\u0430\u0431\u043e\u0442\u044b \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0439. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0442\u043e\u043a\u0435\u043d\u0430. \u0417\u0430\u0442\u0435\u043c \u0434\u0435\u043b\u0430\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u043a \u0447\u0430\u0442\u0443 \u0441 \u0438\u043c\u0435\u044e\u0449\u0438\u043c\u0441\u044f \u0442\u043e\u043a\u0435\u043d\u043e\u0432. \u041d\u0438\u0436\u0435 \u2014 \u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u0430\u043a \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0432 \u043d\u0430\u0448\u0435\u043c \u0431\u043e\u0442\u0435:<\/p>\n<pre><code class=\"javascript\">const { gigaAuth } = require('.\/config') const { v4: uuidv4 } = require('uuid') const axios = require('axios') const qs = require('qs')  \/\/ \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0442\u043e\u043a\u0435\u043d\u0430 async function getToken() { \/\/ \u043a\u043e\u043d\u0444\u0438\u0433 \u0437\u0430\u043f\u0440\u043e\u0441\u0430   const config = {     method: 'post',     maxBodyLength: Infinity,     url: '&lt;https:\/\/ngw.devices.sberbank.ru:9443\/api\/v2\/oauth>',     headers: {       'Content-Type': 'application\/x-www-form-urlencoded',       Accept: 'application\/json',       RqUID: uuidv4(),       Authorization: `Basic ${gigaAuth}`,     },     data: qs.stringify({       scope: 'GIGACHAT_API_PERS'     }),   }    try {     const response = await axios(config)     const { access_token: accessToken, expires_at: expiresAt } = response.data      return { accessToken, expiresAt }   } catch (error) {     console.log(error)   } }  \/\/ \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u043a \u043c\u043e\u0434\u0435\u043b\u0438 \u0443\u0436\u0435 \u0441 \u0442\u043e\u043a\u0435\u043d\u043e\u043c async function giga(content = '', system = '') {   if (!content) return    \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u043e\u043a\u0435\u043d   const token = await getToken()    const messages = []  \/\/ \u0435\u0441\u043b\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u043b\u0438 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442, \u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0435\u0433\u043e \u043a\u0430\u043a \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435.   \/\/ \u0437\u0434\u0435\u0441\u044c \u043c\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043a\u0430\u043a \u0447\u0430\u0442\u0443 \u0441\u0435\u0431\u044f \u0432\u0435\u0441\u0442\u0438   if (system) {     messages.push({ role: 'system', content: system })   }  \/\/ \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f   const data = JSON.stringify({     model: 'GigaChat',     messages: messages.concat([       {         role: 'user',         content,       },     ]),     temperature: 1,     top_p: 0.1,     n: 1,     stream: false,     max_tokens: 512,     repetition_penalty: 1,     update_interval: 0,   })  \/\/ \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441   const config = {     method: 'post',     maxBodyLength: Infinity,     url: '&lt;https:\/\/gigachat.devices.sberbank.ru\/api\/v1\/chat\/completions>',     headers: {       'Content-Type': 'application\/json',       Accept: 'application\/json',       Authorization: `Bearer ${token.accessToken}`,     },     data,   }  \/\/ \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044f \u043e\u0442\u0432\u0435\u0442 \u0441\u0430\u043c\u043e\u0433\u043e \u0447\u0430\u0442\u0430   try {     const response = await axios(config)     const message = response.data.choices[0].message     return message.content   } catch (e) {     console.log(e)   } }  module.exports = { giga } <\/code><\/pre>\n<p>  \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c Telegraf, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0432 Telegram-\u0431\u043e\u0442:<\/p>\n<pre><code class=\"plaintext\">npm i telegraf <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u043e\u043a\u0435\u043d \u0434\u043b\u044f <a href=\"https:\/\/telegram.me\/BotFather\">@BotFather<\/a> \u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u043c Telegram-\u0431\u043e\u0442. \u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430:<\/p>\n<pre><code class=\"javascript\">const { TelegramClient } = require('telegram') const { Telegraf } = require('telegraf') const { NewMessage } = require('telegram\/events') const { session, apiId, apiHash, botToken } = require('.\/config') const { giga } = require('.\/giga')  &lt;h3> \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0431\u043e\u0442\u0430&lt;\/h3> const bot = new Telegraf(botToken) const client = new TelegramClient(session, apiId, apiHash) async function getUnreadMessages(channelId, limit = 10) {   const dialogs = await client.getDialogs({})   const channel = dialogs.find((d) => d.entity.username === channelId)   if (channel) {     const messages = await client.getMessages(channel.entity, {       limit,     })     return messages.map((m) => m.message).join(' ')   } else {     console.log('\u041a\u0430\u043d\u0430\u043b \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d')   } } ;(async function run() {   await client.connect()         \/\/ \u0441\u043b\u0443\u0448\u0430\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 sum   bot.command('sum', async (ctx) => {                 \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043a\u0430\u043a \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b ID-\u043a\u0430\u043d\u0430\u043b\u0430 \u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0434\u043b\u044f GPT     const [, channelId, ...task] = ctx.message.text.split(' ')     if (!channelId) {       return ctx.reply(`\u0412\u044b \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043b\u0438 \u043a\u0430\u043d\u0430\u043b`)     }                 \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u0438\u0437 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0432 \u043a\u0430\u043d\u0430\u043b\u0435     const messagesString = await getUnreadMessages(channelId, 10)                 \/\/ \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0440\u043e\u043b\u044c \u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0438\u0437 \u043a\u0430\u043d\u0430\u043b\u0430 \u0432 GigaChat     const gigaResponse = await giga(messagesString, task.join(' '))                 \/\/ \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043e\u0442\u0432\u0435\u0442 \u043e\u0442 GigaChat \u0441 \u0430\u043d\u0430\u043b\u0438\u0437\u043e\u043c     await ctx.reply(gigaResponse)   })   bot.launch() })() <\/code><\/pre>\n<p>  <a name=\"5\"><\/a><font color=\"#EB4247\"><\/p>\n<h2>\u0414\u0435\u043f\u043b\u043e\u0439<\/h2>\n<p><\/font><br \/>  \u0427\u0442\u043e\u0431\u044b Telegram-\u0431\u043e\u0442 \u0431\u044b\u043b \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u043e\u0434 \u0440\u0443\u043a\u043e\u0439, \u0437\u0430\u0434\u0435\u043f\u043b\u043e\u0438\u043c \u0435\u0433\u043e \u0432 <a href=\"https:\/\/selectel.ru\/services\/cloud\/servers\/?utm_source=habr.com&amp;utm_medium=referral&amp;utm_campaign=cloud_article_bot_250324_content\">\u043e\u0431\u043b\u0430\u043a\u043e Selectel<\/a>. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c \u0448\u0430\u0431\u043b\u043e\u043d \u043a\u043e\u0434\u0430 \u0432 Git:<\/p>\n<pre><code class=\"plaintext\">git init git add . git commit -m \u201cinit\u201d git push -u origin master <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0437\u0430\u0445\u043e\u0434\u0438\u043c \u0432 <a href=\"https:\/\/my.selectel.ru\/\">\u043f\u0430\u043d\u0435\u043b\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f Selectel<\/a>. \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0438\u0437 <b>\u041e\u0431\u043b\u0430\u0447\u043d\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b<\/b> \u0432 <b>\u0421\u0435\u0440\u0432\u0435\u0440\u044b<\/b> \u0438 \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c <b>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440<\/b>.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/535\/c33\/6fb\/535c336fbc0770b6b65cf20333e58caf.png\" width=\"600\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/535\/c33\/6fb\/535c336fbc0770b6b65cf20333e58caf.png\"\/><\/div>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0441\u0435\u0440\u0432\u0435\u0440\u0430.<\/p>\n<ul>\n<li>\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a: Ubuntu 22.04 LTS 64-bit;<\/li>\n<li>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f: \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f, Shared;<\/li>\n<li>\u0414\u043e\u043b\u044f vCPU: 20% (4 vCPU, 8 \u0413\u0411 RAM).<\/li>\n<\/ul>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/975\/c8a\/d2a\/975c8ad2a9a9f6082074d13586a100f1.png\" width=\"600\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/975\/c8a\/d2a\/975c8ad2a9a9f6082074d13586a100f1.png\"\/><\/div>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043d\u0443\u0436\u043d\u043e \u0435\u0433\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c. \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c Git \u0438 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439.<\/p>\n<pre><code class=\"javascript\">apt update apt install git git clone REPO_NAME <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c Node.js \u0438 NPM \u0447\u0435\u0440\u0435\u0437 NVM. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e\u0431 \u044d\u0442\u043e\u043c \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043b\u0438 \u0432 <a href=\"https:\/\/selectel.ru\/blog\/tutorials\/how-to-install-node-js-on-ubuntu-20-04\/\">\u0410\u043a\u0430\u0434\u0435\u043c\u0438\u0438<\/a>.<\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c Node.js \u043d\u0430 Ubuntu 20.04:<\/p>\n<pre><code class=\"javascript\">nvm install 20 nvm use 20 cd REPO_NAME npm install <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c PM2 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0431\u043e\u0442\u0430 \u0432 \u0444\u043e\u043d\u043e\u0432\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435:<\/p>\n<pre><code class=\"plaintext\">npm install pm2 -g pm2 start main <\/code><\/pre>\n<p>  \u0413\u043e\u0442\u043e\u0432\u043e. \u0422\u0435\u043f\u0435\u0440\u044c \u0431\u043e\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c Telegram-\u043a\u0430\u043d\u0430\u043b\u044b \u0438 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u043a\u0438!<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/489\/464\/d23\/489464d2311c50b039f6c03b3b075c22.png\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/489\/464\/d23\/489464d2311c50b039f6c03b3b075c22.png\"\/><\/div>\n<blockquote><p>\u0411\u043e\u043b\u044c\u0448\u0435 \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430 \u043e\u0442 \u0412\u043b\u0430\u0434\u0438\u043b\u0435\u043d\u0430 \u041c\u0438\u043d\u0438\u043d\u0430 \u0432\u044b \u043d\u0430\u0439\u0434\u0435\u0442\u0435 \u043d\u0430 \u0435\u0433\u043e <a href=\"https:\/\/www.youtube.com\/@VladilenMinin\/videos\">YouTube-\u043a\u0430\u043d\u0430\u043b\u0435<\/a>.<\/p><\/blockquote>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \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\/articles\/802629\/\"> https:\/\/habr.com\/ru\/articles\/802629\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/fa\/yu\/v8\/fayuv8envtjvvy5ugnukde0ylhs.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/fa\/yu\/v8\/fayuv8envtjvvy5ugnukde0ylhs.jpeg\" data-blurred=\"true\"\/><\/div>\n<p>  \u0415\u0441\u0442\u044c Telegram-\u043a\u0430\u043d\u0430\u043b\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u044e\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0432 \u043c\u0438\u0440\u0435. \u0410 \u043c\u044b \u0441\u043b\u0435\u0434\u0438\u043c \u0437\u0430 \u0438\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u043c\u0438, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0443\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043d\u0438\u0447\u0435\u0433\u043e \u0432\u0430\u0436\u043d\u043e\u0433\u043e. \u0415\u0441\u043b\u0438 \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u0440\u0443\u0447\u043d\u0443\u044e, \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043d\u0438\u043c\u0430\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0438 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u043a\u043e\u043d\u0446\u0435\u043d\u0442\u0440\u0430\u0446\u0438\u0438 \u043e\u0442 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430. \u0427\u0442\u043e\u0431\u044b \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443, \u043d\u0430\u0448 \u043f\u0430\u0440\u0442\u043d\u0435\u0440 \u0438 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0412\u043b\u0430\u0434\u0438\u043b\u0435\u043d \u041c\u0438\u043d\u0438\u043d \u0441\u043e\u0437\u0434\u0430\u043b Telegram-\u0431\u043e\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438 \u0432\u044b\u0434\u0430\u0435\u0442 \u0440\u0435\u0437\u044e\u043c\u0435 \u043f\u043e \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438.<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c, \u043a\u0430\u043a \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0431\u043e\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0438\u0437 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u0438 \u0437\u0430\u0434\u0435\u043f\u043b\u043e\u0438\u0442\u044c \u0435\u0433\u043e \u043d\u0430 <a href=\"https:\/\/selectel.ru\/services\/cloud\/servers\/?utm_source=habr.com&amp;utm_medium=referral&amp;utm_campaign=cloud_article_bot_250324_content\">\u043e\u0431\u043b\u0430\u0447\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440<\/a>.<\/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-371713","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/371713","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=371713"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/371713\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=371713"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=371713"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=371713"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}