{"id":480061,"date":"2026-05-18T06:30:53","date_gmt":"2026-05-18T06:30:53","guid":{"rendered":"https:\/\/savepearlharbor.com\/?p=480061"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=480061","title":{"rendered":"Telegraf.js \u0443\u043c\u0435\u0440. \u041a\u0430\u043a \u043c\u044b \u043e\u0436\u0438\u0432\u0438\u043b\u0438 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a, \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u043b\u0438 \u044f\u0434\u0440\u043e \u043d\u0430 Native Fetch \u0438 \u0437\u0430\u0442\u0430\u0449\u0438\u043b\u0438 Bot API 9.6"},"content":{"rendered":"<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041a\u0430\u0436\u0434\u044b\u0439, \u043a\u0442\u043e \u043f\u0438\u0448\u0435\u0442 Telegram-\u0431\u043e\u0442\u043e\u0432 \u043d\u0430 Node.js \/ TypeScript, \u0437\u043d\u0430\u0435\u0442 \u043f\u0440\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <strong>Telegraf.js<\/strong>. \u042d\u0442\u043e \u0431\u044b\u043b \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 \u0438\u043d\u0434\u0443\u0441\u0442\u0440\u0438\u0438. \u041a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e \u2014 \u00ab\u0431\u044b\u043b\u00bb. \u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0437\u0430\u0431\u0440\u043e\u0448\u0435\u043d \u043c\u0430\u0439\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430\u043c\u0438, \u043f\u0443\u043b\u043b-\u0440\u0435\u043a\u0432\u0435\u0441\u0442\u044b \u0433\u043e\u0434\u0430\u043c\u0438 \u0432\u0438\u0441\u044f\u0442 \u0431\u0435\u0437 \u043e\u0442\u0432\u0435\u0442\u0430, \u0430 \u0441\u0430\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0437\u0430\u0441\u0442\u0440\u044f\u043b \u0432 \u043f\u0440\u043e\u0448\u043b\u043e\u043c.<\/p>\n<p>\u041f\u043e\u043a\u0430 Telegram \u043e\u0434\u0438\u043d \u0437\u0430 \u0434\u0440\u0443\u0433\u0438\u043c \u0432\u044b\u043a\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u043d\u044b\u0435 \u0430\u043f\u0434\u0435\u0439\u0442\u044b (\u0417\u0432\u0451\u0437\u0434\u044b, \u041f\u043e\u0434\u0430\u0440\u043a\u0438, \u0411\u0438\u0437\u043d\u0435\u0441-\u0430\u043a\u043a\u0430\u0443\u043d\u0442\u044b, \u0423\u043b\u0443\u0447\u0448\u0435\u043d\u043d\u044b\u0435 \u043c\u0435\u0434\u0438\u0430), \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 Telegraf \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u0438\u0437 \u044d\u0442\u043e\u0433\u043e.<\/p>\n<p>\u041c\u043d\u0435 \u043d\u0430\u0434\u043e\u0435\u043b\u043e \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u043f\u0430\u0434\u0430\u044e\u0449\u0438\u0435 \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0435 \u0431\u043e\u0442\u044b \u0438 \u0433\u043e\u0440\u043e\u0434\u0438\u0442\u044c \u043a\u043e\u0441\u0442\u044b\u043b\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0441\u043e\u0437\u0434\u0430\u043b \u0444\u043e\u0440\u043a \u2014 <a href=\"https:\/\/github.com\/telegraf-hardened\/telegraf-hardened\" rel=\"noopener noreferrer nofollow\"><strong>telegraf-hardened<\/strong><\/a>. \u041d\u0430 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u043d\u0435\u0434\u0435\u043b\u0435 \u043c\u044b \u0432\u044b\u043f\u0443\u0441\u0442\u0438\u043b\u0438 \u043c\u0430\u0436\u043e\u0440\u043d\u044b\u0439 \u0440\u0435\u043b\u0438\u0437 <strong>v6.0.0<\/strong>. \u0420\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u044e, \u043a\u0430\u043a \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c \u0443\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u0430\u044f \u043b\u0438\u0431\u0430.<\/p>\n<hr\/>\n<h3>\u0427\u0442\u043e \u043d\u0435 \u0442\u0430\u043a \u0441 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u043c Telegraf.js?<\/h3>\n<p>\u0413\u043b\u0430\u0432\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441\u0442\u0430\u0440\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u2014 \u0435\u0451 \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u0441\u043b\u043e\u0439 \u0438 \u0442\u043e\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043e\u0432 Node.js. \u041e\u043d\u0430 \u0434\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 \u0442\u044f\u043d\u0435\u0442 \u0437\u0430 \u0441\u043e\u0431\u043e\u0439 \u043a\u0443\u0447\u0443 \u0434\u0440\u0435\u0432\u043d\u0438\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0432\u0440\u043e\u0434\u0435 <code>node-fetch<\/code>, <code>abort-controller<\/code> \u0438 <code>sandwich-stream<\/code>.<\/p>\n<p>\u0412\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u2014 \u043f\u043e\u043b\u043d\u043e\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u043e\u0439 \u043e\u0442\u043a\u0430\u0437\u043e\u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u043e\u0441\u0442\u0438 (fail-fast). \u0411\u043e\u0442 \u043c\u043e\u0433 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c\u0441\u044f \u0441 \u0431\u0438\u0442\u044b\u043c \u0442\u043e\u043a\u0435\u043d\u043e\u043c, \u043d\u0438\u043a\u0430\u043a \u043e\u0431 \u044d\u0442\u043e\u043c \u043d\u0435 \u0441\u043e\u043e\u0431\u0449\u0438\u0442\u044c, \u0430 \u0443\u043f\u0430\u0441\u0442\u044c \u0432 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0446\u0438\u043a\u043b \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u043e\u0432 (crash-loop) \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0435\u0440\u0435\u0437 \u0447\u0430\u0441, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u043b\u0435\u0442\u0438\u0442 \u043f\u0435\u0440\u0432\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0438\u043b\u0438 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432\u0435\u0431\u0445\u0443\u043a.<\/p>\n<hr\/>\n<h3>\u0427\u0442\u043e \u044f \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u043b \u0432 \u044f\u0434\u0440\u0435 (Hardened-\u0444\u0438\u0447\u0438)<\/h3>\n<p>\u041c\u043e\u0435\u0439 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u0431\u044b\u043b\u043e \u0438\u0437\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0442 \u043b\u0435\u0433\u0430\u0441\u0438-\u043c\u0443\u0441\u043e\u0440\u0430 \u0438 \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u0412\u043e\u0442 \u0447\u0442\u043e \u0431\u044b\u043b\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e:<\/p>\n<ol>\n<li>\n<p><strong>Native Node.js Fetch API:<\/strong> \u042f \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0432\u044b\u0440\u0435\u0437\u0430\u043b <code>node-fetch<\/code> \u0438 \u0441\u043e\u043f\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043e\u0431\u0451\u0440\u0442\u043a\u0438. \u0422\u0435\u043f\u0435\u0440\u044c \u044f\u0434\u0440\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430 \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u043c Fetch (\u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 Node.js 18+). \u042d\u0442\u043e \u0434\u0430\u043b\u043e \u043f\u0440\u0438\u0440\u043e\u0441\u0442 \u043a \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438 \u0443\u0431\u0440\u0430\u043b\u043e \u043b\u0438\u0448\u043d\u0438\u0435 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0438 \u0438\u0437 supply-chain.<\/p>\n<\/li>\n<li>\n<p><strong>\u0412\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u043a\u0441\u0438 (SOCKS5\/TOR\/HTTP):<\/strong> \u0411\u043e\u043b\u044c\u0448\u0435 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 fetch-\u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u043e\u0432. \u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u043f\u0440\u043e\u043a\u0441\u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u00ab\u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438\u00bb \u043d\u0430 \u0431\u0430\u0437\u0435 <code>undici<\/code> \u0438 <code>socks<\/code>. \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0438\u043d\u0436\u0435\u043a\u0442\u0438\u0442\u0441\u044f \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0432 \u043a\u043b\u0438\u0435\u043d\u0442.<\/p>\n<\/li>\n<li>\n<p><strong>\u0411\u043e\u0440\u044c\u0431\u0430 \u0441 409 Conflict:<\/strong> \u0412 Docker \u0438\u043b\u0438 PM2 \u043f\u0440\u0438 \u0431\u044b\u0441\u0442\u0440\u043e\u043c \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 Telegram \u0447\u0430\u0441\u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0443 <code>409: Conflict<\/code> (\u0441\u0442\u0430\u0440\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0435\u0449\u0435 \u043d\u0435 \u0437\u0430\u043a\u0440\u044b\u043b\u043e\u0441\u044c, \u0430 \u043d\u043e\u0432\u043e\u0435 \u0443\u0436\u0435 \u043b\u043e\u043c\u0438\u0442\u0441\u044f). \u0420\u0430\u043d\u044c\u0448\u0435 \u0431\u043e\u0442 \u043e\u0442 \u044d\u0442\u043e\u0433\u043e \u043f\u0430\u0434\u0430\u043b. \u042f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0431\u044d\u043aoff (<code>retryOnConflict<\/code>), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043b\u0430\u0432\u043d\u043e \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 getUpdates, \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0430\u044f \u0446\u0438\u043a\u043b\u0438\u0447\u043d\u044b\u0439 \u043a\u0440\u0430\u0448.<\/p>\n<\/li>\n<li>\n<p><strong>Fail-Fast \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f:<\/strong> \u0422\u043e\u043a\u0435\u043d \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u0433\u043e \u043f\u0440\u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430. \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 <code>bot.validateTokenAsync()<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u0435\u043b\u0430\u0435\u0442 \u043f\u0440\u0435\u0434-\u0437\u0430\u043f\u0440\u043e\u0441 \u043a <code>getMe<\/code> \u0438 \u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u043c 401 Unauthorized \u0434\u043e \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0431\u043e\u0442 \u0443\u0441\u043f\u0435\u0435\u0442 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043d\u0435\u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0439 \u0441\u0442\u0435\u0439\u0442.<\/p>\n<\/li>\n<\/ol>\n<hr\/>\n<h3>\u0421\u0438\u043b\u0430 \u043e\u043f\u0435\u043d\u0441\u043e\u0440\u0441\u0430: \u0421\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0441 Bot API 9.6<\/h3>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u044b\u0439 \u0444\u0443\u043d\u0434\u0430\u043c\u0435\u043d\u0442 \u0431\u044b\u043b \u0433\u043e\u0442\u043e\u0432, \u043a \u043f\u0440\u043e\u0435\u043a\u0442\u0443 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043b\u0441\u044f \u043a\u0440\u0443\u0442\u043e\u0439 \u0437\u0430\u0440\u0443\u0431\u0435\u0436\u043d\u044b\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a <strong>Sixia &#171;Leask&#187; Huang (@LeaskH)<\/strong>. \u041e\u043d \u043f\u0440\u0438\u0441\u043b\u0430\u043b \u043e\u0433\u0440\u043e\u043c\u043d\u044b\u0439 \u043f\u0443\u043b\u043b-\u0440\u0435\u043a\u0432\u0435\u0441\u0442 \u043d\u0430 1700+ \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430, \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0437\u0430\u043a\u0440\u044b\u0432 \u043d\u0430\u0448 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0439 Roadmap v3.<\/p>\n<p>\u0421\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u044b\u043c\u0438 \u0443\u0441\u0438\u043b\u0438\u044f\u043c\u0438 \u043c\u044b \u0437\u0430\u0442\u0430\u0449\u0438\u043b\u0438 \u0432 \u0440\u0435\u043b\u0438\u0437 v6.0.0:<\/p>\n<ul>\n<li>\n<p><strong>\u041f\u043e\u043b\u043d\u044b\u0439 \u043f\u0430\u0440\u0438\u0442\u0435\u0442 \u0441 Telegram Bot API 9.6<\/strong> (\u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043c\u0435\u0442\u043e\u0434\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043e \u0417\u0432\u0451\u0437\u0434\u0430\u043c\u0438, \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430\u043c\u0438 \u043f\u043b\u0430\u0442\u0435\u0436\u0435\u0439, \u041f\u043e\u0434\u0430\u0440\u043a\u0430\u043c\u0438 <code>getUserGifts<\/code> \u0438 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 \u0434\u043b\u044f \u0411\u0438\u0437\u043d\u0435\u0441-\u0430\u043a\u043a\u0430\u0443\u043d\u0442\u043e\u0432).<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0442\u0440\u043e\u0433\u0443\u044e \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u044e:<\/strong> \u041e\u0431\u043d\u043e\u0432\u0438\u043b\u0438 \u0438 \u0430\u043b\u0438\u0430\u0441\u043d\u0443\u043b\u0438 <code>@telegraf-hardened\/types<\/code>. \u0422\u0435\u043f\u0435\u0440\u044c TypeScript \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0431\u044c\u0451\u0442 \u043f\u043e \u0440\u0443\u043a\u0430\u043c, \u0435\u0441\u043b\u0438 \u0432\u044b \u043f\u044b\u0442\u0430\u0435\u0442\u0435\u0441\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043d\u0435\u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e <code>chat_id<\/code> \u0438 <code>inline_message_id<\/code> \u0432 <code>editMessageText<\/code>).<\/p>\n<\/li>\n<li>\n<p><strong>\u0422\u0435\u0441\u0442\u044b \u043d\u0430 \u0434\u0440\u0438\u0444\u0442 API:<\/strong> \u0414\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 AVA smoke-\u0442\u0435\u0441\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u0442 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0440\u0430\u043d\u0442\u0430\u0439\u043c-\u0441\u0451\u0440\u0444\u0435\u0439\u0441 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043a\u043b\u0430\u0441\u0441\u0430 <code>Telegram<\/code> \u0441 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c \u0442\u0438\u043f\u043e\u0432. \u0415\u0441\u043b\u0438 Telegram \u0434\u043e\u0431\u0430\u0432\u0438\u0442 \u043c\u0435\u0442\u043e\u0434, \u0430 \u043c\u044b \u0435\u0433\u043e \u043d\u0435 \u043e\u043f\u0438\u0448\u0435\u043c \u2014 \u0442\u0435\u0441\u0442\u044b \u0443\u043f\u0430\u0434\u0443\u0442 \u0432 CI.<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h3>\u041a\u0430\u043a \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c?<\/h3>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f drop-in replacement (\u0431\u0435\u0441\u0448\u043e\u0432\u043d\u043e\u0439 \u0437\u0430\u043c\u0435\u043d\u043e\u0439) \u0434\u043b\u044f \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0422\u0435\u043b\u0435\u0433\u0440\u0430\u0444\u0430. \u0414\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043f\u0438\u0448\u0435\u043c:<\/p>\n<p>Bash<\/p>\n<pre><code>npm install telegraf-hardened<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:87px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441 \u043d\u043e\u0432\u044b\u043c\u0438 \u0444\u0438\u0447\u0430\u043c\u0438 API 9.6:<\/p>\n<p>JavaScript<\/p>\n<pre><code class=\"javascript\">const { Telegraf } = require('telegraf-hardened')const bot = new Telegraf(process.env.BOT_TOKEN);(async () =&gt; {    \/\/ Fail-fast \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0442\u043e\u043a\u0435\u043d\u0430 \u043d\u0430 \u0441\u0442\u0430\u0440\u0442\u0435    await bot.validateTokenAsync()        \/\/ \u041f\u0440\u0438\u043c\u0435\u0440 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u043e\u0434\u0430\u0440\u043a\u043e\u0432 \u0438\u0437 API 9.6    bot.command('my_gifts', async (ctx) =&gt; {        const { total_count, gifts } = await ctx.telegram.getUserGifts(ctx.from.id)        return ctx.reply(`\u0423 \u0432\u0430\u0441 ${total_count} \u043f\u043e\u0434\u0430\u0440\u043a\u043e\u0432!`)    })        \/\/ \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u044b\u0439 \u043f\u043e\u043b\u0438\u043d\u0433 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 409 \u043e\u0448\u0438\u0431\u043e\u043a    bot.launch({        polling: {            retryOnConflict: true,            maxRetryDelay: 30000        }    })})()<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041f\u0440\u043e\u0435\u043a\u0442 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439, \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0439 \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u043c\u044c\u044e\u043d\u0438\u0442\u0438. \u0415\u0441\u043b\u0438 \u0432\u044b \u0443\u0441\u0442\u0430\u043b\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 Telegraf.js \u0437\u0430\u0431\u0440\u043e\u0448\u0435\u043d \u2014 \u043f\u0435\u0440\u0435\u0435\u0437\u0436\u0430\u0439\u0442\u0435 \u043d\u0430 hardened-\u0432\u0435\u0440\u0441\u0438\u044e. \u0411\u0443\u0434\u0435\u043c \u0440\u0430\u0434\u044b \u0432\u0430\u0448\u0438\u043c \u0438\u0448\u044c\u044e, \u043f\u0443\u043b\u043b-\u0440\u0435\u043a\u0432\u0435\u0441\u0442\u0430\u043c \u0438 \u0437\u0432\u0451\u0437\u0434\u0430\u043c \u043d\u0430 \u0413\u0438\u0442\u0445\u0430\u0431\u0435!<\/p>\n<blockquote>\n<p><a href=\"https:\/\/github.com\/telegraf-hardened\/telegraf-hardened\" rel=\"noopener noreferrer nofollow\">\u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0430 GitHub<\/a><\/p>\n<\/blockquote>\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\/articles\/1036250\/\">https:\/\/habr.com\/ru\/articles\/1036250\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041a\u0430\u0436\u0434\u044b\u0439, \u043a\u0442\u043e \u043f\u0438\u0448\u0435\u0442 Telegram-\u0431\u043e\u0442\u043e\u0432 \u043d\u0430 Node.js \/ TypeScript, \u0437\u043d\u0430\u0435\u0442 \u043f\u0440\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 Telegraf.js. \u042d\u0442\u043e \u0431\u044b\u043b \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 \u0438\u043d\u0434\u0443\u0441\u0442\u0440\u0438\u0438. \u041a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e \u2014 \u00ab\u0431\u044b\u043b\u00bb. \u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0437\u0430\u0431\u0440\u043e\u0448\u0435\u043d \u043c\u0430\u0439\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430\u043c\u0438, \u043f\u0443\u043b\u043b-\u0440\u0435\u043a\u0432\u0435\u0441\u0442\u044b \u0433\u043e\u0434\u0430\u043c\u0438 \u0432\u0438\u0441\u044f\u0442 \u0431\u0435\u0437 \u043e\u0442\u0432\u0435\u0442\u0430, \u0430 \u0441\u0430\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0437\u0430\u0441\u0442\u0440\u044f\u043b \u0432 \u043f\u0440\u043e\u0448\u043b\u043e\u043c.\u041f\u043e\u043a\u0430 Telegram \u043e\u0434\u0438\u043d \u0437\u0430 \u0434\u0440\u0443\u0433\u0438\u043c \u0432\u044b\u043a\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u043d\u044b\u0435 \u0430\u043f\u0434\u0435\u0439\u0442\u044b (\u0417\u0432\u0451\u0437\u0434\u044b, \u041f\u043e\u0434\u0430\u0440\u043a\u0438, \u0411\u0438\u0437\u043d\u0435\u0441-\u0430\u043a\u043a\u0430\u0443\u043d\u0442\u044b, \u0423\u043b\u0443\u0447\u0448\u0435\u043d\u043d\u044b\u0435 \u043c\u0435\u0434\u0438\u0430), \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 Telegraf \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u0438\u0437 \u044d\u0442\u043e\u0433\u043e.\u041c\u043d\u0435 \u043d\u0430\u0434\u043e\u0435\u043b\u043e \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u043f\u0430\u0434\u0430\u044e\u0449\u0438\u0435 \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0435 \u0431\u043e\u0442\u044b \u0438 \u0433\u043e\u0440\u043e\u0434\u0438\u0442\u044c \u043a\u043e\u0441\u0442\u044b\u043b\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0441\u043e\u0437\u0434\u0430\u043b \u0444\u043e\u0440\u043a \u2014 telegraf-hardened. \u041d\u0430 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u043d\u0435\u0434\u0435\u043b\u0435 \u043c\u044b \u0432\u044b\u043f\u0443\u0441\u0442\u0438\u043b\u0438 \u043c\u0430\u0436\u043e\u0440\u043d\u044b\u0439 \u0440\u0435\u043b\u0438\u0437 v6.0.0. \u0420\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u044e, \u043a\u0430\u043a \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c \u0443\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u0430\u044f \u043b\u0438\u0431\u0430.\u0427\u0442\u043e \u043d\u0435 \u0442\u0430\u043a \u0441 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u043c Telegraf.js?\u0413\u043b\u0430\u0432\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441\u0442\u0430\u0440\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u2014 \u0435\u0451 \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u0441\u043b\u043e\u0439 \u0438 \u0442\u043e\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043e\u0432 Node.js. \u041e\u043d\u0430 \u0434\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 \u0442\u044f\u043d\u0435\u0442 \u0437\u0430 \u0441\u043e\u0431\u043e\u0439 \u043a\u0443\u0447\u0443 \u0434\u0440\u0435\u0432\u043d\u0438\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0432\u0440\u043e\u0434\u0435 node-fetch, abort-controller \u0438 sandwich-stream.\u0412\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u2014 \u043f\u043e\u043b\u043d\u043e\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u043e\u0439 \u043e\u0442\u043a\u0430\u0437\u043e\u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u043e\u0441\u0442\u0438 (fail-fast). \u0411\u043e\u0442 \u043c\u043e\u0433 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c\u0441\u044f \u0441 \u0431\u0438\u0442\u044b\u043c \u0442\u043e\u043a\u0435\u043d\u043e\u043c, \u043d\u0438\u043a\u0430\u043a \u043e\u0431 \u044d\u0442\u043e\u043c \u043d\u0435 \u0441\u043e\u043e\u0431\u0449\u0438\u0442\u044c, \u0430 \u0443\u043f\u0430\u0441\u0442\u044c \u0432 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0446\u0438\u043a\u043b \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u043e\u0432 (crash-loop) \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0435\u0440\u0435\u0437 \u0447\u0430\u0441, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u043b\u0435\u0442\u0438\u0442 \u043f\u0435\u0440\u0432\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0438\u043b\u0438 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432\u0435\u0431\u0445\u0443\u043a.\u0427\u0442\u043e \u044f \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u043b \u0432 \u044f\u0434\u0440\u0435 (Hardened-\u0444\u0438\u0447\u0438)\u041c\u043e\u0435\u0439 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u0431\u044b\u043b\u043e \u0438\u0437\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0442 \u043b\u0435\u0433\u0430\u0441\u0438-\u043c\u0443\u0441\u043e\u0440\u0430 \u0438 \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u0412\u043e\u0442 \u0447\u0442\u043e \u0431\u044b\u043b\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e:Native Node.js Fetch API: \u042f \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0432\u044b\u0440\u0435\u0437\u0430\u043b node-fetch \u0438 \u0441\u043e\u043f\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043e\u0431\u0451\u0440\u0442\u043a\u0438. \u0422\u0435\u043f\u0435\u0440\u044c \u044f\u0434\u0440\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430 \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u043c Fetch (\u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 Node.js 18+). \u042d\u0442\u043e \u0434\u0430\u043b\u043e \u043f\u0440\u0438\u0440\u043e\u0441\u0442 \u043a \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438 \u0443\u0431\u0440\u0430\u043b\u043e \u043b\u0438\u0448\u043d\u0438\u0435 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0438 \u0438\u0437 supply-chain.\u0412\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u043a\u0441\u0438 (SOCKS5\/TOR\/HTTP): \u0411\u043e\u043b\u044c\u0448\u0435 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 fetch-\u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u043e\u0432. \u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u043f\u0440\u043e\u043a\u0441\u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u00ab\u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438\u00bb \u043d\u0430 \u0431\u0430\u0437\u0435 undici \u0438 socks. \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0438\u043d\u0436\u0435\u043a\u0442\u0438\u0442\u0441\u044f \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0432 \u043a\u043b\u0438\u0435\u043d\u0442.\u0411\u043e\u0440\u044c\u0431\u0430 \u0441 409 Conflict: \u0412 Docker \u0438\u043b\u0438 PM2 \u043f\u0440\u0438 \u0431\u044b\u0441\u0442\u0440\u043e\u043c \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 Telegram \u0447\u0430\u0441\u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0443 409: Conflict (\u0441\u0442\u0430\u0440\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0435\u0449\u0435 \u043d\u0435 \u0437\u0430\u043a\u0440\u044b\u043b\u043e\u0441\u044c, \u0430 \u043d\u043e\u0432\u043e\u0435 \u0443\u0436\u0435 \u043b\u043e\u043c\u0438\u0442\u0441\u044f). \u0420\u0430\u043d\u044c\u0448\u0435 \u0431\u043e\u0442 \u043e\u0442 \u044d\u0442\u043e\u0433\u043e \u043f\u0430\u0434\u0430\u043b. \u042f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0431\u044d\u043aoff (retryOnConflict), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043b\u0430\u0432\u043d\u043e \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 getUpdates, \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0430\u044f \u0446\u0438\u043a\u043b\u0438\u0447\u043d\u044b\u0439 \u043a\u0440\u0430\u0448.Fail-Fast \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f: \u0422\u043e\u043a\u0435\u043d \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u0433\u043e \u043f\u0440\u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430. \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 bot.validateTokenAsync(), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u0435\u043b\u0430\u0435\u0442 \u043f\u0440\u0435\u0434-\u0437\u0430\u043f\u0440\u043e\u0441 \u043a getMe \u0438 \u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u043c 401 Unauthorized \u0434\u043e \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0431\u043e\u0442 \u0443\u0441\u043f\u0435\u0435\u0442 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043d\u0435\u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0439 \u0441\u0442\u0435\u0439\u0442.\u0421\u0438\u043b\u0430 \u043e\u043f\u0435\u043d\u0441\u043e\u0440\u0441\u0430: \u0421\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0441 Bot API 9.6\u041a\u043e\u0433\u0434\u0430 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u044b\u0439 \u0444\u0443\u043d\u0434\u0430\u043c\u0435\u043d\u0442 \u0431\u044b\u043b \u0433\u043e\u0442\u043e\u0432, \u043a \u043f\u0440\u043e\u0435\u043a\u0442\u0443 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043b\u0441\u044f \u043a\u0440\u0443\u0442\u043e\u0439 \u0437\u0430\u0440\u0443\u0431\u0435\u0436\u043d\u044b\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a Sixia &#171;Leask&#187; Huang (@LeaskH). \u041e\u043d \u043f\u0440\u0438\u0441\u043b\u0430\u043b \u043e\u0433\u0440\u043e\u043c\u043d\u044b\u0439 \u043f\u0443\u043b\u043b-\u0440\u0435\u043a\u0432\u0435\u0441\u0442 \u043d\u0430 1700+ \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430, \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0437\u0430\u043a\u0440\u044b\u0432 \u043d\u0430\u0448 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0439 Roadmap v3.\u0421\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u044b\u043c\u0438 \u0443\u0441\u0438\u043b\u0438\u044f\u043c\u0438 \u043c\u044b \u0437\u0430\u0442\u0430\u0449\u0438\u043b\u0438 \u0432 \u0440\u0435\u043b\u0438\u0437 v6.0.0:\u041f\u043e\u043b\u043d\u044b\u0439 \u043f\u0430\u0440\u0438\u0442\u0435\u0442 \u0441 Telegram Bot API 9.6 (\u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043c\u0435\u0442\u043e\u0434\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043e \u0417\u0432\u0451\u0437\u0434\u0430\u043c\u0438, \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430\u043c\u0438 \u043f\u043b\u0430\u0442\u0435\u0436\u0435\u0439, \u041f\u043e\u0434\u0430\u0440\u043a\u0430\u043c\u0438 getUserGifts \u0438 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 \u0434\u043b\u044f \u0411\u0438\u0437\u043d\u0435\u0441-\u0430\u043a\u043a\u0430\u0443\u043d\u0442\u043e\u0432).\u0421\u0442\u0440\u043e\u0433\u0443\u044e \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u044e: \u041e\u0431\u043d\u043e\u0432\u0438\u043b\u0438 \u0438 \u0430\u043b\u0438\u0430\u0441\u043d\u0443\u043b\u0438 @telegraf-hardened\/types. \u0422\u0435\u043f\u0435\u0440\u044c TypeScript \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0431\u044c\u0451\u0442 \u043f\u043e \u0440\u0443\u043a\u0430\u043c, \u0435\u0441\u043b\u0438 \u0432\u044b \u043f\u044b\u0442\u0430\u0435\u0442\u0435\u0441\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043d\u0435\u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e chat_id \u0438 inline_message_id \u0432 editMessageText).\u0422\u0435\u0441\u0442\u044b \u043d\u0430 \u0434\u0440\u0438\u0444\u0442 API: \u0414\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 AVA smoke-\u0442\u0435\u0441\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u0442 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0440\u0430\u043d\u0442\u0430\u0439\u043c-\u0441\u0451\u0440\u0444\u0435\u0439\u0441 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043a\u043b\u0430\u0441\u0441\u0430 Telegram \u0441 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c \u0442\u0438\u043f\u043e\u0432. \u0415\u0441\u043b\u0438 Telegram \u0434\u043e\u0431\u0430\u0432\u0438\u0442 \u043c\u0435\u0442\u043e\u0434, \u0430 \u043c\u044b \u0435\u0433\u043e \u043d\u0435 \u043e\u043f\u0438\u0448\u0435\u043c \u2014 \u0442\u0435\u0441\u0442\u044b \u0443\u043f\u0430\u0434\u0443\u0442 \u0432 CI.\u041a\u0430\u043a \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c?\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f drop-in replacement (\u0431\u0435\u0441\u0448\u043e\u0432\u043d\u043e\u0439 \u0437\u0430\u043c\u0435\u043d\u043e\u0439) \u0434\u043b\u044f \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0422\u0435\u043b\u0435\u0433\u0440\u0430\u0444\u0430. \u0414\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043f\u0438\u0448\u0435\u043c:Bashnpm install telegraf-hardened\u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441 \u043d\u043e\u0432\u044b\u043c\u0438 \u0444\u0438\u0447\u0430\u043c\u0438 API 9.6:JavaScriptconst { Telegraf } = require(&#8216;telegraf-hardened&#8217;)const bot = new Telegraf(process.env.BOT_TOKEN);(async () =&gt; {    \/\/ Fail-fast \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0442\u043e\u043a\u0435\u043d\u0430 \u043d\u0430 \u0441\u0442\u0430\u0440\u0442\u0435    await bot.validateTokenAsync()        \/\/ \u041f\u0440\u0438\u043c\u0435\u0440 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u043e\u0434\u0430\u0440\u043a\u043e\u0432 \u0438\u0437 API 9.6    bot.command(&#8216;my_gifts&#8217;, async (ctx) =&gt; {        const { total_count, gifts } = await ctx.telegram.getUserGifts(ctx.from.id)        return ctx.reply(`\u0423 \u0432\u0430\u0441 ${total_count} \u043f\u043e\u0434\u0430\u0440\u043a\u043e\u0432!`)    })        \/\/ \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u044b\u0439 \u043f\u043e\u043b\u0438\u043d\u0433 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 409 \u043e\u0448\u0438\u0431\u043e\u043a    bot.launch({        polling: {            retryOnConflict: true,            maxRetryDelay: 30000        }    })})()\u041f\u0440\u043e\u0435\u043a\u0442 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439, \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0439 \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u043c\u044c\u044e\u043d\u0438\u0442\u0438. \u0415\u0441\u043b\u0438 \u0432\u044b \u0443\u0441\u0442\u0430\u043b\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 Telegraf.js \u0437\u0430\u0431\u0440\u043e\u0448\u0435\u043d \u2014 \u043f\u0435\u0440\u0435\u0435\u0437\u0436\u0430\u0439\u0442\u0435 \u043d\u0430 hardened-\u0432\u0435\u0440\u0441\u0438\u044e. \u0411\u0443\u0434\u0435\u043c \u0440\u0430\u0434\u044b \u0432\u0430\u0448\u0438\u043c \u0438\u0448\u044c\u044e, \u043f\u0443\u043b\u043b-\u0440\u0435\u043a\u0432\u0435\u0441\u0442\u0430\u043c \u0438 \u0437\u0432\u0451\u0437\u0434\u0430\u043c \u043d\u0430 \u0413\u0438\u0442\u0445\u0430\u0431\u0435!\u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0430 GitHub\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 https:\/\/habr.com\/ru\/articles\/1036250\/<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-480061","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/480061","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=480061"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/480061\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=480061"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=480061"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=480061"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}