{"id":297023,"date":"2020-01-12T21:00:08","date_gmt":"2020-01-12T21:00:08","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=297023"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=297023","title":{"rendered":"Telegram-\u0431\u043e\u0442 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/483660\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/f-\/dc\/ax\/f-dcaxuxg0id5fqzmenau-wyi4c.jpeg\" alt=\"image\"><\/p>\n<p>  \u041f\u043e \u043c\u043e\u0442\u0438\u0432\u0430\u043c \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/317906\/\">\u0422\u0435\u043b\u0435\u0433\u0440\u0430\u043c\u043c-\u0431\u043e\u0442 \u0434\u043b\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430 <\/a> (\u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0435 \u043c\u043e\u044f, \u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043b) \u0437\u0430\u0445\u043e\u0442\u0435\u043b \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u043e\u043f\u044b\u0442\u043e\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f Telegram-\u0431\u043e\u0442\u0430 \u043d\u0430 PowerShell \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u043c\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u0411\u0443\u0434\u0435\u0442 \u0442\u0435\u043a\u0441\u0442, \u043a\u043e\u0434 \u0438 \u043d\u0435\u043c\u043d\u043e\u0436\u043a\u043e \u043a\u0430\u0440\u0442\u0438\u043d\u043e\u043a. \u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u0438\u0432\u043d\u0430\u044f \u043a\u0440\u0438\u0442\u0438\u043a\u0430 \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442\u0441\u044f ( \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0437\u0432\u0443\u0447\u0430\u043b\u043e \u00ab\u0437\u0430\u0447\u0435\u043c \u043d\u0430 PowerShell? \u041d\u0430\u0434\u043e \u0431\u044b\u043b\u043e \u043d\u0430 perl\u00bb ).<\/p>\n<p>  \u0414\u0443\u043c\u0430\u044e \u0447\u0442\u043e \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442 \u00ab\u043d\u043e\u0432\u0438\u0447\u043a\u0430\u043c\u00bb \u0432 PowerShell, \u043d\u043e \u0438 \u043e\u043f\u044b\u0442\u043d\u044b\u0435 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u044b \u043c\u043e\u0433\u0443\u0442 \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0435 \u0437\u0434\u0435\u0441\u044c \u0443\u0432\u0438\u0434\u0435\u0442\u044c.<\/p>\n<p>  \u0421\u0430\u043c\u0443 \u0441\u0442\u0430\u0442\u044c\u044e \u0441\u0442\u0430\u0440\u0430\u043b\u0441\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u043e \u0447\u0430\u0441\u0442\u044f\u043c \u2013 \u043e\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043a \u0441\u043b\u043e\u0436\u043d\u043e\u043c\u0443. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u0442\u0441\u044f \u043f\u043b\u0430\u0433\u0438\u0430\u0442, \u0431\u0443\u0434\u044c\u0442\u0435 \u0431\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u044b!<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c\u0438 \u0438\u043b\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445 (\u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c), \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043b\u043e\u0433\u0438 \u0438 \u0435\u0449\u0435 \u043a\u0430\u043a\u0443\u044e-\u0442\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438. \u0412\u0441\u0451 \u044d\u0442\u043e \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0434\u0435\u043b\u0430\u0442\u044c (\u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043d\u0435\u0442), \u043d\u0430\u0445\u043e\u0434\u044f\u0441\u044c \u0432 \u043c\u0435\u0442\u0440\u043e, \u0432 \u043c\u0430\u0433\u0430\u0437\u0438\u043d\u0435 \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 \u043b\u0451\u0436\u0430 \u043d\u0430 \u0434\u0438\u0432\u0430\u043d\u0435, \u0431\u0435\u0437 VPN \u0438 \u043d\u043e\u0443\u0442\u0431\u0443\u043a\u043e\u0432. \u0418\u0437 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0439 (\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u044b, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043d\u0430 \u043a\u043e\u043b\u0435\u043d\u043a\u0435).<\/p>\n<ul>\n<li>\u041f\u0440\u043e\u0441\u0442\u043e\u0442\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f\/\u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447 \u0432 Telegram-\u0431\u043e\u0442<\/li>\n<li>\u041c\u043d\u043e\u0433\u043e\u0437\u0430\u0434\u0430\u0447\u043d\u043e\u0441\u0442\u044c \u0438\u043b\u0438 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0437\u0430\u0446\u0438\u044f <\/li>\n<li>\u00ab\u041f\u043e\u043d\u044f\u0442\u043d\u044b\u0439\u00bb \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f<\/li>\n<li>\u0425\u043e\u0442\u044c \u043a\u0430\u043a\u0430\u044f-\u0442\u043e \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c<\/li>\n<\/ul>\n<p><a name=\"habracut\"><\/a><br \/>  \u0412 \u043a\u0430\u043a\u043e\u0439 \u0442\u043e \u043c\u043e\u043c\u0435\u043d\u0442 \u0431\u044b\u043b\u043e \u0440\u0435\u0448\u0435\u043d\u043e \u0432\u044b\u043d\u043e\u0441\u0438\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u2013 \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 xml (\u0442\u0443\u0442 \u043a\u0442\u043e-\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0441\u0451 \u0432 json, \u043d\u043e \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0432 xml \u0438 \u0431\u044b\u043b\u0438 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u044b)<br \/>  \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043d\u0430\u0447\u0430\u043b\u0430:<\/p>\n<h3>\u0427\u0430\u0441\u0442\u044c 1: \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c-\u0431\u043e\u0442<\/h3>\n<p>  \u0418\u0449\u0435\u043c \u043f\u0430\u043f\u043a\u0443-\u0431\u043e\u0442\u0430 (\u043d\u0435 \u043a\u0430\u0442\u0430\u043b\u043e\u0433) \u2013 <i>BotFather (@BotFather)<\/i> \u0432 Telegram<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/gp\/qz\/oa\/gpqzoakmx6j1swm_q2zbrajcpae.jpeg\" alt=\"BotFather\"><\/p>\n<p>  \u041f\u0438\u0448\u0435\u043c <a href=\"https:\/\/core.telegram.org\/bots#creating-a-new-bot\" rel=\"nofollow\">\/newbot<\/a><br \/>  \u0414\u0430\u043b\u0435\u0435, \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c \u0438\u043c\u044f \u0431\u043e\u0442\u0443 (\u0432 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044f \u043d\u0430\u0437\u0432\u0430\u043b Haaaabr \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0441\u0442\u0430\u0442\u044c\u0438) \u0438 username, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u043b\u0436\u0435\u043d \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u00abbot\u00bb (Haaaabr_bot)<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e BotFather \u0432\u044b\u0434\u0430\u0441\u0442 \u0442\u043e\u043a\u0435\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0438 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ia\/er\/vm\/iaervmphz5nsdm4tjwysrtr-zd4.jpeg\" alt=\"image\"><\/p>\n<p>  \u0414\u0430\u043b\u044c\u0448\u0435 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0434\u043b\u044f \u0431\u043e\u0442\u0430 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443, \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c Description, \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u043a\u043e\u043c\u0430\u043d\u0434, \u043d\u043e \u043c\u043d\u0435 \u0431\u044b\u043b\u043e \u043b\u0435\u043d\u044c.<\/p>\n<p>  \u0414\u0435\u043b\u0430\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0431\u043e\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0438 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u043d\u0430 \u043d\u0438\u0445.<\/p>\n<p>  \u042f \u0431\u0443\u0434\u0443 \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434 PS \u0447\u0430\u0441\u0442\u044f\u043c\u0438 \u0438 \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c full-\u043a\u043e\u0434 \u0434\u043b\u044f \u0440\u0435\u0444\u0435\u0440\u0435\u043d\u0441\u0430.<\/p>\n<p>  \u0414\u043b\u044f \u0441\u043f\u0440\u0430\u0432\u043a\u0438 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0432\u044b\u0437\u043e\u0432\u043e\u0432 API <a href=\"https:\/\/core.telegram.org\/bots\/api\" rel=\"nofollow\">Telegram Bot API<\/a><\/p>\n<p>  \u041d\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u043d\u0443\u0436\u043d\u043e 2 \u043c\u0435\u0442\u043e\u0434\u0430: <\/p>\n<p>  <i>getUpdates<\/i> \u2013 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0431\u043e\u0442\u043e\u043c(\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u043c) \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439<br \/>  <i>sendMessage<\/i> \u2013 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0431\u043e\u0442\u043e\u043c(\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u043c) \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e<\/p>\n<p>  \u0422\u0430\u043c \u0436\u0435, \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e:  <\/p>\n<blockquote><p>Making requests<br \/>  All queries to the Telegram Bot API must be served over HTTPS and need to be presented in this form: <a href=\"https:\/\/api.telegram.org\/bot&lt;token&gt;\/METHOD_NAME\" rel=\"nofollow\">api.telegram.org\/bot&lt;token&gt;\/METHOD_NAME<\/a> <\/p><\/blockquote>\n<p>  <u>\u0428\u0430\u0433 1 \u2013 \u043f\u0440\u0438\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439<\/u><br \/>  \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435<\/p>\n<pre><code class=\"powershell\"># Token $token = \"***********************\" # Telegram URLs $URL_get = \"https:\/\/api.telegram.org\/bot$token\/getUpdates\" $URL_set = \"https:\/\/api.telegram.org\/bot$token\/sendMessage\" <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c, \u0447\u0442\u043e \u043e\u0442\u0434\u0430\u0435\u0442 \u0432\u044b\u0437\u043e\u0432 <i>$URL_get<\/i><\/p>\n<pre><code class=\"powershell\">Invoke-RestMethod -Uri $URL_get<\/code><\/pre>\n<p>  <code> ok result<br \/>   -- ------<br \/>  True {} <\/code><\/p>\n<p>  \u041d\u043e\u0442 \u0431\u044d\u0434. \u041d\u0430\u043f\u0438\u0448\u0435\u043c \u0447\u0442\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u0431\u043e\u0442\u0443:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ub\/kn\/jd\/ubknjd-kciskp6cvbjd9ejj9umm.jpeg\" alt=\"Hello\"><\/p>\n<p>  \u0418 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0435\u043c:<\/p>\n<pre><code class=\"powershell\"># Token $token = \"***********************\" # Telegram URLs $URL_get = \"https:\/\/api.telegram.org\/bot$token\/getUpdates\" $URL_set = \"https:\/\/api.telegram.org\/bot$token\/sendMessage\"   Invoke-RestMethod -Uri $URL_get <\/code><\/pre>\n<p>  <code>ok result <br \/>   -- ------ <br \/>  True {@{update_id=635172027; message=}, @{update_id=635172028; message=}<\/code>} <\/p>\n<p>  \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d result. \u0421\u0440\u0430\u0437\u0443 \u0441\u043a\u0430\u0436\u0443, \u0447\u0442\u043e \u043d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"powershell\"># Token $token = \"***********************\" # Telegram URLs $URL_get = \"https:\/\/api.telegram.org\/bot$token\/getUpdates\" $URL_set = \"https:\/\/api.telegram.org\/bot$token\/sendMessage\"  $json = Invoke-RestMethod -Uri $URL_get  $data = $json.result | Select-Object -Last 1  $data.update_id  $data.message.chat.id $data.message.text $data.message.chat.first_name $data.message.chat.last_name $data.message.chat.type $data.message.chat.username <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c confirm, \u0447\u0442\u043e \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435. \u0414\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u044d\u0442\u043e \u0432\u0441\u0435 \u0442\u0430\u043a\u0436\u0435, \u0447\u0435\u0440\u0435\u0437 \u043c\u0435\u0442\u043e\u0434 <i>getUpdates<\/i> \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c <i>offset<\/i>:  <\/p>\n<blockquote><p>By default, updates starting with the earliest unconfirmed update are returned. An update is considered confirmed as soon as getUpdates is called with an offset higher than its update_id<\/p><\/blockquote>\n<p>  \u0414\u0435\u043b\u0430\u0435\u043c<\/p>\n<pre><code class=\"powershell\">Invoke-RestMethod \"$($URL_get)?offset=$($($data.update_id)+1)\" -Method Get | Out-Null <\/code><\/pre>\n<p>  \u0418 \u043a\u0438\u0434\u0430\u0435\u043c \u044d\u0442\u043e \u0432\u0441\u0435 \u0432 \u0446\u0438\u043a\u043b c \u0442\u0430\u0439\u043c\u0430\u0443\u0442\u043e\u043c \u0432 1 \u0441\u0435\u043a\u0443\u043d\u0434\u0443:<\/p>\n<pre><code class=\"powershell\"># Token $token = \"***********************\" # Telegram URLs $URL_get = \"https:\/\/api.telegram.org\/bot$token\/getUpdates\" $URL_set = \"https:\/\/api.telegram.org\/bot$token\/sendMessage\"  # timeout sec $timeout = 1  while($true) # \u0432\u0435\u0447\u043d\u044b\u0439 \u0446\u0438\u043a\u043b {     $json = Invoke-RestMethod -Uri $URL_get      $data = $json.result | Select-Object -Last 1      $data.update_id     $data.message.chat.id     $data.message.text     $data.message.chat.first_name     $data.message.chat.last_name     $data.message.chat.type     $data.message.chat.username      Invoke-RestMethod \"$($URL_get)?offset=$($($data.update_id)+1)\" -Method Get | Out-Null      Start-Sleep -s $timeout     } <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0447\u0442\u0435\u043d\u0438\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439. \u0422.\u043a. \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u2013 \u0440\u0435\u0448\u0438\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c HashTable (\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0439\/\u0430\u0441\u0441\u043e\u0446\u0438\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432)<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043a\u0440\u0438\u043f\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"powershell\"># Token $token = \"***********************\"# Telegram URLs $URL_get = \"https:\/\/api.telegram.org\/bot$token\/getUpdates\" $URL_set = \"https:\/\/api.telegram.org\/bot$token\/sendMessage\"  # timeout sec $timeout = 1  function getUpdates($URL) {     $json = Invoke-RestMethod -Uri $URL     $data = $json.result | Select-Object -Last 1      #$data.update_id     $chat_id = $data.message.chat.id     $text = $data.message.text     $f_name = $data.message.chat.first_name     $l_name = $data.message.chat.last_name     $type = $data.message.chat.type     $username = $data.message.chat.username      # \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0447\u0442\u043e text \u0435\u0441\u0442\u044c     if($text)     {         # confirm         Invoke-RestMethod \"$($URL)?offset=$($($data.update_id)+1)\" -Method Get | Out-Null          # HashTable         $ht = @{}         $ht[\"chat_id\"] = $chat_id         $ht[\"text\"] = $text         $ht[\"f_name\"] = $f_name         $ht[\"l_name\"] = $l_name         $ht[\"username\"] = $username         return $ht     } }  while($true) # \u0432\u0435\u0447\u043d\u044b\u0439 \u0446\u0438\u043a\u043b {     # \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e      getUpdates $URL_get      Start-Sleep -s $timeout     } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <u>\u0428\u0430\u0433 2 \u2013 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445<\/u><br \/>  \u0414\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u043c\u0435\u0442\u043e\u0434 <i>sendMessage <\/i>\u0438 \u043f\u043e\u043b\u044f <i>chat_id<\/i> \u0438 <i>text <\/i>(\u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e <a href=\"https:\/\/core.telegram.org\/bots\/api#sendmessage\" rel=\"nofollow\">https:\/\/core.telegram.org\/bots\/api#sendmessage<\/a>).<\/p>\n<p>  \u0421\u0440\u0430\u0437\u0443 \u0437\u0430\u043f\u0438\u043b\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e<\/p>\n<pre><code class=\"powershell\">function sendMessage($URL, $chat_id, $text) {     # \u0441\u043e\u0437\u0434\u0430\u0435\u043c HashTable, \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0442\u044c \u0435\u0435 \u0438 \u0442\u0430\u043a\u0438\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c     $ht = @{         text = $text         # \u0443\u043a\u0430\u0437\u0430\u043d \u0441\u043f\u043e\u0441\u043e\u0431 \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438 Markdown         parse_mode = \"Markdown\"         chat_id = $chat_id     }     # \u0414\u0430\u043d\u043d\u044b\u0435 \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 json     $json = $ht | ConvertTo-Json     # \u0414\u0435\u043b\u0430\u0435\u043c \u0447\u0435\u0440\u0435\u0437 Invoke-RestMethod, \u043d\u043e \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u0437\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438 \u0447\u0435\u0440\u0435\u0437 Invoke-WebRequest     # Method Post - \u0442.\u043a. \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e Get     Invoke-RestMethod $URL -Method Post -ContentType 'application\/json; charset=utf-8' -Body $json     } <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u0432\u044b\u0437\u0432\u0430\u0432<\/p>\n<pre><code class=\"powershell\">sendMessage $URL_set &lt;\u0432\u0430\u0448_\u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c_id&gt; \"\u0422\u0435\u0441\u0442123\" <\/code><\/pre>\n<p>  \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432 \u0442\u0435\u043b\u0435\u0433\u0435.<\/p>\n<p>  <u>\u0428\u0430\u0433 3 \u2013 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0432\u0441\u0435 \u0432\u043c\u0435\u0441\u0442\u0435<\/u><\/p>\n<p>  \u041d\u0438\u0436\u0435 \u0432\u0435\u0441\u044c \u043a\u043e\u0434 \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438-\u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"powershell\"># Token $token = \"***********************\" # Telegram URLs $URL_get = \"https:\/\/api.telegram.org\/bot$token\/getUpdates\" $URL_set = \"https:\/\/api.telegram.org\/bot$token\/sendMessage\"  # timeout sec $timeout = 1  function getUpdates($URL) {     $json = Invoke-RestMethod -Uri $URL     $data = $json.result | Select-Object -Last 1      #$data.update_id     $chat_id = $data.message.chat.id     $text = $data.message.text     $f_name = $data.message.chat.first_name     $l_name = $data.message.chat.last_name     $type = $data.message.chat.type     $username = $data.message.chat.username      # \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0447\u0442\u043e text \u0435\u0441\u0442\u044c     if($text)     {         # confirm         Invoke-RestMethod \"$($URL)?offset=$($($data.update_id)+1)\" -Method Get | Out-Null          # HashTable         $ht = @{}         $ht[\"chat_id\"] = $chat_id         $ht[\"text\"] = $text         $ht[\"f_name\"] = $f_name         $ht[\"l_name\"] = $l_name         $ht[\"username\"] = $username         return $ht     } } function sendMessage($URL, $chat_id, $text) {     # \u0441\u043e\u0437\u0434\u0430\u0435\u043c HashTable, \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0442\u044c \u0435\u0435 \u0438 \u0442\u0430\u043a\u0438\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c     $ht = @{         text = $text         # \u0443\u043a\u0430\u0437\u0430\u043d \u0441\u043f\u043e\u0441\u043e\u0431 \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438 Markdown         parse_mode = \"Markdown\"         chat_id = $chat_id     }     # \u0414\u0430\u043d\u043d\u044b\u0435 \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 json     $json = $ht | ConvertTo-Json     # \u0414\u0435\u043b\u0430\u0435\u043c \u0447\u0435\u0440\u0435\u0437 Invoke-RestMethod, \u043d\u043e \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u0437\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438 \u0447\u0435\u0440\u0435\u0437 Invoke-WebRequest     # Method Post - \u0442.\u043a. \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e Get     Invoke-RestMethod $URL -Method Post -ContentType 'application\/json; charset=utf-8' -Body $json | Out-Null    }  while($true) # \u0432\u0435\u0447\u043d\u044b\u0439 \u0446\u0438\u043a\u043b {     $return = getUpdates $URL_get     if($return)     {         # http:\/\/apps.timwhitlock.info\/emoji\/tables\/unicode#block-1-emoticons         sendMessage $URL_set $return.chat_id (Get-Random(\"\", \"\", \"\", \"\"))     }     Start-Sleep -s $timeout } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0414\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0443\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 <i>$return.text<\/i> \u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <i>switch<\/i>:  <\/p>\n<pre><code class=\"powershell\">switch -Wildcard ($return[\"text\"]) {     \"*\u043f\u0440\u0438\u0432\u0435\u0442*\" { sendMessage $URL_set $return.chat_id \"\u041f\u0440\u0438\u0432\u0435\u0442, $($return[\"f_name\"])\" }     \"*\u043a\u0430\u043a \u0434\u0435\u043b\u0430?*\" { sendMessage $URL_set $return.chat_id \"\u0425\u043e\u0440\u043e\u0448\u043e\" }     default {sendMessage $URL_set $return.chat_id \"$(Get-Random(\"\", \"\", \"\", \"\"))\"} } <\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Emoji:<\/b><\/p>\n<div class=\"spoiler_text\">\u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u043b\u0435\u0442\u0435 Get-Random \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f emoji, \u0432 \u043a\u043e\u0434 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u0443 \u043c\u0435\u043d\u044f \u0438\u0445 \u0432\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c, \u043d\u043e PS \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442 \u0438\u0445 \u043d\u0430\u0442\u0438\u0432\u043d\u043e<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ra\/r6\/4g\/rar64gloyqqnimwf7m3lds23hs0.jpeg\" alt=\"Get-Random\">  <\/div>\n<\/div>\n<p>  <\/p>\n<h3>\u0427\u0430\u0441\u0442\u044c 2: \u043d\u0443\u0436\u043d\u044b \u043a\u043d\u043e\u043f\u043a\u0438<\/h3>\n<p>  \u0412 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c \u0431\u043e\u0442\u0435 \u0435\u0441\u0442\u044c \u043e\u043f\u0446\u0438\u044f \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u0430 \u043a\u043e\u043c\u0430\u043d\u0434 (\u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u043e\u0442 \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u0437\u043d\u0430\u0447\u043a\u0443 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ug\/5v\/bz\/ug5vbz4hhz5cajcrg4auifrhw2y.jpeg\" alt=\"Icon\"> )<br \/>  \u041f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043c\u044b \u0442\u0430\u043a \u0438 \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u2013 \u0431\u044b\u043b \u043d\u0430\u0431\u043e\u0440 \u043a\u043e\u043c\u0430\u043d\u0434, \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u043b\u0438 \u0442\u0443\u0434\u0430 \u0438\u043c\u0435\u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 \u0438\u043b\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432. \u041f\u043e\u0442\u043e\u043c \u0440\u0435\u0448\u0438\u043b\u0438, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435 \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 User Friendly \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432 \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043a\u043d\u043e\u043f\u043e\u043a.<\/p>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u044b\u0437\u0432\u043e\u0432 <i>sendMessage <\/i>c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c <i>reply_markup<\/i><\/p>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0442\u0438\u043f <i>InlineKeyboardMarkup<\/i><br \/>  <a href=\"https:\/\/core.telegram.org\/bots\/api#inlinekeyboardmarkup\" rel=\"nofollow\">https:\/\/core.telegram.org\/bots\/api#inlinekeyboardmarkup <\/a>.<\/p>\n<p>  \u0418\u0437 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u043b\u0435\u0434\u0443\u0435\u0442, \u0447\u0442\u043e \u043f\u043e\u043b\u0435 <i>inline_keyboard<\/i>\u2013 \u044d\u0442\u043e \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043a\u043d\u043e\u043f\u043e\u043a <\/p>\n<blockquote><p>(Array of Array of InlineKeyboardButton )<\/p><\/blockquote>\n<p>  \u041f\u0440\u043e\u0431\u0443\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u043e\u0432\u0443\u044e \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0443 \u043a\u043d\u043e\u043f\u043e\u043a<\/p>\n<pre><code class=\"powershell\"># Token $token = \"***********************\" # Telegram URLs $URL_get = \"https:\/\/api.telegram.org\/bot$token\/getUpdates\" $URL_set = \"https:\/\/api.telegram.org\/bot$token\/sendMessage\"  # \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u043e\u043b\u0435 callback_data \u0447\u0442\u043e\u0431\u044b \u0437\u043d\u0430\u0442\u044c, \u043a\u0430\u043a\u0443\u044e \u043a\u043d\u043e\u043f\u043a\u0443 \u043d\u0430\u0436\u0430\u043b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c $button1 = @{ \"text\" = \"Test1\"; callback_data = \"Test1_CD\"} $button2 = @{ \"text\" = \"Test2\"; callback_data = \"Test2_CD\"}  $keyboard = @{\"inline_keyboard\" = @(,@($button1, $button2))}  $ht = @{      parse_mode = \"Markdown\"     reply_markup = $keyboard     chat_id = ******** # \u0437\u0434\u0435\u0441\u044c \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0441\u0432\u043e\u0439 Telegram ID     text = \"Test Text\" }  $json = $ht | ConvertTo-Json Invoke-RestMethod $URL_set -Method Post -ContentType 'application\/json; charset=utf-8' -Body $json<\/code><\/pre>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c Error:<br \/>  <i>Invoke-RestMethod: {\u00abok\u00bb:false,\u00aberror_code\u00bb:400,\u00abdescription\u00bb:\u00abBad Request: field \\\u00bbinline_keyboard\\&#187; of the InlineKeyboardMarkup should be an Array of Arrays&#187;}<br \/>  At line:21 char:1<\/i><\/p>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0447\u0442\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <i>$json<\/i> <\/p>\n<p>  \u0412\u044b\u0432\u043e\u0434:<\/p>\n<pre><code class=\"json\">{     \"reply_markup\":  {                          \"inline_keyboard\":  [                                                  \"System.Collections.Hashtable System.Collections.Hashtable\"                                              ]                      },     \"chat_id\":  **********,     \"text\":  \"Test Text\",     \"parse_mode\":  \"Markdown\" }<\/code><\/pre>\n<p>  \u0412\u0438\u0434\u0438\u043c\u043e \u043a\u0430\u043a-\u0442\u043e \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 HashTable (\u00abSystem.Collections.Hashtable System.Collections.Hashtable\u00bb) \u0434\u043b\u044f api \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c\u0430. \u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0433\u0443\u0433\u043b\u0430 \u0438 \u0438\u0442\u043e\u0433 \u2013 \u043f\u0440\u0438 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0432 Json \u0441\u0442\u0430\u0432\u0438\u043c \u0433\u043b\u0443\u0431\u0438\u043d\u0443 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438<\/p>\n<pre><code class=\"powershell\"># Token $token = \"***********************\" # Telegram URLs $URL_get = \"https:\/\/api.telegram.org\/bot$token\/getUpdates\" $URL_set = \"https:\/\/api.telegram.org\/bot$token\/sendMessage\"  # \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u043e\u043b\u0435 callback_data \u0447\u0442\u043e\u0431\u044b \u0437\u043d\u0430\u0442\u044c, \u043a\u0430\u043a\u0443\u044e \u043a\u043d\u043e\u043f\u043a\u0443 \u043d\u0430\u0436\u0430\u043b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c $button1 = @{ \"text\" = \"Test1\"; callback_data = \"Test1_CD\"} $button2 = @{ \"text\" = \"Test2\"; callback_data = \"Test2_CD\"}  $keyboard = @{\"inline_keyboard\" = @(,@($button1, $button2))}  $ht = @{      parse_mode = \"Markdown\"     reply_markup = $keyboard     chat_id = ********     text = \"Test Text\" }  $json = $ht | ConvertTo-Json -Depth 5 Invoke-RestMethod $URL_set -Method Post -ContentType 'application\/json; charset=utf-8' -Body $json <\/code><\/pre>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043a\u043d\u043e\u043f\u043a\u0438:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/wf\/8x\/e7\/wf8xe7gkgmydxrbyftj_fph58fo.jpeg\" alt=\"Buttons\"><\/p>\n<p>  \u0414\u0435\u043b\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0435 \u043a\u043d\u043e\u043f\u043e\u043a, \u043d\u0430 \u0432\u0445\u043e\u0434 \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u0434\u0430\u0432\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u043a\u043d\u043e\u043f\u043e\u043a<\/p>\n<pre><code class=\"powershell\"># Token $token = \"***********************\" # Telegram URLs $URL_get = \"https:\/\/api.telegram.org\/bot$token\/getUpdates\" $URL_set = \"https:\/\/api.telegram.org\/bot$token\/sendMessage\"  # \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u043e\u043b\u0435 callback_data \u0447\u0442\u043e\u0431\u044b \u0437\u043d\u0430\u0442\u044c, \u043a\u0430\u043a\u0443\u044e \u043a\u043d\u043e\u043f\u043a\u0443 \u043d\u0430\u0436\u0430\u043b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c $button1 = @{ \"text\" = \"Test1\"; callback_data = \"Test1_CD\"} $button2 = @{ \"text\" = \"Test2\"; callback_data = \"Test2_CD\"} $buttons = ($button1, $button2)  function sendKeyboard($URL, $buttons) {     $keyboard = @{\"inline_keyboard\" = @(,$buttons)}     $ht = @{          parse_mode = \"Markdown\"         reply_markup = $keyboard         chat_id = ********         text = \"Test Text\"     }      $json = $ht | ConvertTo-Json -Depth 5     Invoke-RestMethod $URL_set -Method Post -ContentType 'application\/json; charset=utf-8' -Body $json      }  sendKeyboard $URL_set $buttons <\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0432\u0441\u0435 \u0432\u043e\u0435\u0434\u0438\u043d\u043e, \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043c\u0435\u043d\u044f\u0432 \u0431\u043b\u043e\u043a switch<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"powershell\"># Token $token = \"***********************\" # Telegram URLs $URL_get = \"https:\/\/api.telegram.org\/bot$token\/getUpdates\" $URL_set = \"https:\/\/api.telegram.org\/bot$token\/sendMessage\"  # timeout sec $timeout = 1  function getUpdates($URL) {     $json = Invoke-RestMethod -Uri $URL     $data = $json.result | Select-Object -Last 1      #$data.update_id     $chat_id = $data.message.chat.id     $text = $data.message.text     $f_name = $data.message.chat.first_name     $l_name = $data.message.chat.last_name     $type = $data.message.chat.type     $username = $data.message.chat.username      # \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0447\u0442\u043e text \u0435\u0441\u0442\u044c     if($text)     {         # confirm         Invoke-RestMethod \"$($URL)?offset=$($($data.update_id)+1)\" -Method Get | Out-Null          # HashTable         $ht = @{}         $ht[\"chat_id\"] = $chat_id         $ht[\"text\"] = $text         $ht[\"f_name\"] = $f_name         $ht[\"l_name\"] = $l_name         $ht[\"username\"] = $username         return $ht     } } function sendMessage($URL, $chat_id, $text) {     # \u0441\u043e\u0437\u0434\u0430\u0435\u043c HashTable, \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0442\u044c \u0435\u0435 \u0438 \u0442\u0430\u043a\u0438\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c     $ht = @{         text = $text         # \u0443\u043a\u0430\u0437\u0430\u043d \u0441\u043f\u043e\u0441\u043e\u0431 \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438 Markdown         parse_mode = \"Markdown\"         chat_id = $chat_id     }     # \u0414\u0430\u043d\u043d\u044b\u0435 \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 json     $json = $ht | ConvertTo-Json     # \u0414\u0435\u043b\u0430\u0435\u043c \u0447\u0435\u0440\u0435\u0437 Invoke-RestMethod, \u043d\u043e \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u0437\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438 \u0447\u0435\u0440\u0435\u0437 Invoke-WebRequest     # Method Post - \u0442.\u043a. \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e Get     Invoke-RestMethod $URL -Method Post -ContentType 'application\/json; charset=utf-8' -Body $json | Out-Null    } function sendKeyboard($URL, $buttons, $chat_id, $text) {     $keyboard = @{\"inline_keyboard\" = @(,$buttons)}     $ht = @{          parse_mode = \"Markdown\"         reply_markup = $keyboard         chat_id = $chat_id         text = $text     }      $json = $ht | ConvertTo-Json -Depth 5     Invoke-RestMethod $URL -Method Post -ContentType 'application\/json; charset=utf-8' -Body $json      }  while($true) # \u0432\u0435\u0447\u043d\u044b\u0439 \u0446\u0438\u043a\u043b {     $return = getUpdates $URL_get     if($return)     {         # http:\/\/apps.timwhitlock.info\/emoji\/tables\/unicode#block-1-emoticons         #sendMessage $URL_set $return.chat_id (Get-Random(\"\", \"\", \"\", \"\"))         write-host \"$($return[\"chat_id\"])\"         switch -Wildcard ($return[\"text\"])         {             \"*\u043f\u0440\u0438\u0432\u0435\u0442*\" {                 $button1 = @{ \"text\" = \"Project1\"; callback_data = \"Project1_CD\"}                 $button2 = @{ \"text\" = \"Project2\"; callback_data = \"Project2_CD\"}                 $buttons = ($button1, $button2)                 $text = \"Available projects:\"                 $chat_id = $return.chat_id                 sendKeyboard $URL_set $buttons $chat_id $text                 #sendMessage $URL_set $return.chat_id \"\u041f\u0440\u0438\u0432\u0435\u0442, $($return[\"f_name\"])\"              }             \"*\u043a\u0430\u043a \u0434\u0435\u043b\u0430?*\" { sendMessage $URL_set $return.chat_id \"\u0425\u043e\u0440\u043e\u0448\u043e\" }             default {sendMessage $URL_set $return.chat_id \"$(Get-Random(\"\", \"\", \"\", \"\"))\"}         }         }     Start-Sleep -s $timeout }<\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430 \u00ab\u043f\u0440\u0438\u0432\u0435\u0442\u00bb \u0431\u043e\u0442 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u0430\u043c \u043f\u0430\u0440\u0443 \u043a\u043d\u043e\u043f\u043e\u043a. \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u0430\u043a\u0443\u044e \u043a\u043d\u043e\u043f\u043a\u0443 \u043d\u0430\u0436\u0430\u043b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c. \u0412 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 ps-\u0444\u0443\u043d\u043a\u0446\u0438\u0438 getUpdates \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 <\/p>\n<pre><code class=\"powershell\">if($text)...<\/code><\/pre>\n<p>  \u041f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u0442\u0435\u043a\u0441\u0442 \u043d\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043d\u0443\u0436\u043d\u043e \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e. \u041d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/mk\/cb\/la\/mkcblawc0-d6uppcfqnkvgzrabo.jpeg\" alt=\"PushTheButton\"><\/p>\n<p>  \u0418 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043a\u0443\u0441\u043e\u043a \u043a\u043e\u0434\u0430 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e <i>$data<\/i><\/p>\n<pre><code class=\"powershell\"># Token $token = \"***********************\" # Telegram URLs $URL_get = \"https:\/\/api.telegram.org\/bot$token\/getUpdates\" $URL_set = \"https:\/\/api.telegram.org\/bot$token\/sendMessage\"  # timeout sec $timeout = 1  function getUpdates($URL) {     $json = Invoke-RestMethod -Uri $URL     $data = $json.result | Select-Object -Last 1      $data &lt;#     $chat_id = $data.message.chat.id     $text = $data.message.text     $f_name = $data.message.chat.first_name     $l_name = $data.message.chat.last_name     $type = $data.message.chat.type     $username = $data.message.chat.username      # \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0447\u0442\u043e text \u0435\u0441\u0442\u044c     if($text)     {         # confirm         Invoke-RestMethod \"$($URL)?offset=$($($data.update_id)+1)\" -Method Get | Out-Null          # HashTable         $ht = @{}         $ht[\"chat_id\"] = $chat_id         $ht[\"text\"] = $text         $ht[\"f_name\"] = $f_name         $ht[\"l_name\"] = $l_name         $ht[\"username\"] = $username         return $ht     } #&gt; }  getUpdates $URL_get <\/code><\/pre>\n<p>  \u041d\u0438\u043a\u0430\u043a\u043e\u0439 message \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u043f\u0440\u0438\u043b\u0435\u0442\u0430\u0435\u0442. \u0412\u043c\u0435\u0441\u0442\u043e \u043d\u0435\u0433\u043e \u0442\u0435\u043f\u0435\u0440\u044c <i>callback_query<\/i>. \u041f\u0440\u0430\u0432\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e<\/p>\n<pre><code class=\"powershell\"># Token $token = \"***********************\" # Telegram URLs $URL_get = \"https:\/\/api.telegram.org\/bot$token\/getUpdates\" $URL_set = \"https:\/\/api.telegram.org\/bot$token\/sendMessage\"  # timeout sec $timeout = 1  function getUpdates($URL) {     $json = Invoke-RestMethod -Uri $URL     $data = $json.result | Select-Object -Last 1     # \u041d\u0430\u0436\u0430\u0442\u0438\u0435 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443     if($data.callback_query)     {           $callback_data = $data.callback_query.data         $chat_id = $data.callback_query.from.id         $f_name = $data.callback_query.from.first_name         $l_name = $data.callback_query.from.last_name         $username = $data.callback_query.from.username     }     # \u041e\u0431\u044b\u0447\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435     elseif($data.message)     {         $chat_id = $data.message.chat.id         $text = $data.message.text         $f_name = $data.message.chat.first_name         $l_name = $data.message.chat.last_name         $type = $data.message.chat.type         $username = $data.message.chat.username      }      $ht = @{}     $ht[\"chat_id\"] = $chat_id     $ht[\"text\"] = $text     $ht[\"f_name\"] = $f_name     $ht[\"l_name\"] = $l_name     $ht[\"username\"] = $username     $ht[\"callback_data\"] = $callback_data     # confirm     Invoke-RestMethod \"$($URL)?offset=$($($data.update_id)+1)\" -Method Get | Out-Null          return $ht } getUpdates $URL_get <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <i>text<\/i>, \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u0438\u043b\u0438 <i>callback_data<\/i>, \u0435\u0441\u043b\u0438 \u0431\u044b\u043b\u043e \u043d\u0430\u0436\u0430\u0442\u0438\u0435 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443. \u041d\u0430 \u044d\u0442\u0430\u043f\u0435 \u0442\u0435\u0441\u0442\u043e\u0432 \u0441\u043b\u043e\u0432\u0438\u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0443 \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435:<\/p>\n<pre><code class=\"powershell\">sendMessage $URL_set $($return.chat_id) $($return.callback_data)<\/code><\/pre>\n<p>  <i>Invoke-RestMethod: {\u00abok\u00bb:false,\u00aberror_code\u00bb:400,\u00abdescription\u00bb:\u00abBad Request: can&#8217;t parse entities: Can&#8217;t find end of the entity starting at byte offset 8\u00bb} <\/i><\/p>\n<p>  \u0422\u0430\u043a \u043a\u0430\u043a <i>parse_mode<\/i> \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u0432 <i>Markdown<\/i>, \u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0439 \u0442\u0435\u043a\u0441\u0442<\/p>\n<pre><code class=\"powershell\">$return.callback_data = \u201cProject1_CD\u201d<\/code><\/pre>\n<p>  \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u043e\u0439 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0442\u0443\u0442:<br \/>  <a href=\"https:\/\/core.telegram.org\/bots\/api#formatting-options\" rel=\"nofollow\">https:\/\/core.telegram.org\/bots\/api#formatting-options<\/a><br \/>  \u0438\u043b\u0438 \u0443\u0431\u0440\u0430\u0442\u044c \u043d\u0438\u0436\u043d\u0435\u0435 \u043f\u043e\u0434\u0447\u0435\u0440\u043a\u0438\u0432\u0430\u043d\u0438\u0435 \u00ab_\u00bb<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0418\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"powershell\"># Token $token = \"***********************\" # Telegram URLs $URL_get = \"https:\/\/api.telegram.org\/bot$token\/getUpdates\" $URL_set = \"https:\/\/api.telegram.org\/bot$token\/sendMessage\"  # timeout sec $timeout = 1  function getUpdates($URL) {     $json = Invoke-RestMethod -Uri $URL     $data = $json.result | Select-Object -Last 1      # \u041e\u0431\u043d\u0443\u043b\u044f\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435     $text = $null     $callback_data = $null      # \u041d\u0430\u0436\u0430\u0442\u0438\u0435 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443     if($data.callback_query)     {           $callback_data = $data.callback_query.data         $chat_id = $data.callback_query.from.id         $f_name = $data.callback_query.from.first_name         $l_name = $data.callback_query.from.last_name         $username = $data.callback_query.from.username     }     # \u041e\u0431\u044b\u0447\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435     elseif($data.message)     {         $chat_id = $data.message.chat.id         $text = $data.message.text         $f_name = $data.message.chat.first_name         $l_name = $data.message.chat.last_name         $type = $data.message.chat.type         $username = $data.message.chat.username     }      $ht = @{}     $ht[\"chat_id\"] = $chat_id     $ht[\"text\"] = $text     $ht[\"f_name\"] = $f_name     $ht[\"l_name\"] = $l_name     $ht[\"username\"] = $username     $ht[\"callback_data\"] = $callback_data     # confirm     Invoke-RestMethod \"$($URL)?offset=$($($data.update_id)+1)\" -Method Get | Out-Null          return $ht }  function sendMessage($URL, $chat_id, $text) {     # \u0441\u043e\u0437\u0434\u0430\u0435\u043c HashTable, \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0442\u044c \u0435\u0435 \u0438 \u0442\u0430\u043a\u0438\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c     $ht = @{         text = $text         # \u0443\u043a\u0430\u0437\u0430\u043d \u0441\u043f\u043e\u0441\u043e\u0431 \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438 Markdown         parse_mode = \"Markdown\"         chat_id = $chat_id     }     # \u0414\u0430\u043d\u043d\u044b\u0435 \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 json     $json = $ht | ConvertTo-Json     # \u0414\u0435\u043b\u0430\u0435\u043c \u0447\u0435\u0440\u0435\u0437 Invoke-RestMethod, \u043d\u043e \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u0437\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438 \u0447\u0435\u0440\u0435\u0437 Invoke-WebRequest     # Method Post - \u0442.\u043a. \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e Get     Invoke-RestMethod $URL -Method Post -ContentType 'application\/json; charset=utf-8' -Body $json | Out-Null    } function sendKeyboard($URL, $buttons, $chat_id, $text) {     $keyboard = @{\"inline_keyboard\" = @(,$buttons)}     $ht = @{          parse_mode = \"Markdown\"         reply_markup = $keyboard         chat_id = $chat_id         text = $text     }      $json = $ht | ConvertTo-Json -Depth 5     Invoke-RestMethod $URL -Method Post -ContentType 'application\/json; charset=utf-8' -Body $json      }  while($true) # \u0432\u0435\u0447\u043d\u044b\u0439 \u0446\u0438\u043a\u043b {     $return = getUpdates $URL_get     #$return      # \u0415\u0441\u043b\u0438 \u043e\u0431\u044b\u0447\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435     if($return.text)     {          # http:\/\/apps.timwhitlock.info\/emoji\/tables\/unicode#block-1-emoticons         #sendMessage $URL_set $return.chat_id (Get-Random(\"\", \"\", \"\", \"\"))         write-host \"$($return[\"chat_id\"])\"         switch -Wildcard ($return[\"text\"])         {             \"*\u043f\u0440\u0438\u0432\u0435\u0442*\" {                 $button1 = @{ \"text\" = \"Project1\"; callback_data = \"Project1CD\"}                 $button2 = @{ \"text\" = \"Project2\"; callback_data = \"Project2CD\"}                 $buttons = ($button1, $button2)                 $text = \"Available projects:\"                 $chat_id = $return.chat_id                 sendKeyboard $URL_set $buttons $chat_id $text                 #sendMessage $URL_set $return.chat_id \"\u041f\u0440\u0438\u0432\u0435\u0442, $($return[\"f_name\"])\"              }             \"*\u043a\u0430\u043a \u0434\u0435\u043b\u0430?*\" { sendMessage $URL_set $return.chat_id \"\u0425\u043e\u0440\u043e\u0448\u043e\" }             default {sendMessage $URL_set $return.chat_id \"$(Get-Random(\"\", \"\", \"\", \"\"))\"}         }        }     # \u0435\u0441\u043b\u0438 \u0431\u044b\u043b\u043e \u043d\u0430\u0436\u0430\u0442\u0438\u0435 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443     elseif($return.callback_data)     {         sendMessage $URL_set $($return.chat_id) $($return.callback_data)     }     Start-Sleep -s $timeout } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h3>\u0427\u0430\u0441\u0442\u044c 3: \u0434\u0435\u043b\u0430\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433<\/h3>\n<p>\u041d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u0441\u0451 \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433. \u0422\u0443\u0442 \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u2013 \u0434\u0435\u043b\u0430\u0435\u043c xml:<\/p>\n<pre><code class=\"xml\">&lt;config&gt; \t&lt;system&gt; \t\t&lt;token&gt;***********************&lt;\/token&gt; \t\t&lt;timeout desc=\"bot check timeout in seconds\"&gt;1&lt;\/timeout&gt; \t&lt;\/system&gt; \t&lt;tasks&gt; \t\t&lt;task name=\"\u041f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0432\u0441\u0435\" script=\"c:\\Temp\\Habr\\reboot_all.ps1\"&gt;&lt;\/task&gt; \t\t&lt;task name=\"\u0421\u0442\u0430\u0442\u0443\u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432\" script=\"c:\\Temp\\Habr\\status.ps1\"&gt;&lt;\/task&gt; \t\t&lt;task name=\"ipconfig1\" script=\"ipconfig\"&gt;&lt;\/task&gt; \t\t&lt;task name=\"ipconfig2\" script=\"ipconfig\"&gt;&lt;\/task&gt; \t\t&lt;task name=\"ipconfig3\" script=\"ipconfig\"&gt;&lt;\/task&gt; \t\t&lt;task name=\"ipconfig4\" script=\"ipconfig\"&gt;&lt;\/task&gt; \t\t&lt;task name=\"ipconfig5\" script=\"ipconfig\"&gt;&lt;\/task&gt; \t&lt;\/tasks&gt; &lt;\/config&gt; <\/code><\/pre>\n<p>  \u041e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0437\u0430\u0434\u0430\u0447\u0438 (tasks) \u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442 \u0438\u043b\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0443.<br \/>  \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c:<\/p>\n<pre><code class=\"powershell\">[xml]$xmlConfig = Get-Content -Path (\"c:\\Temp\\Habr\\telegram_bot.xml\") $token = $xmlConfig.config.system.token $timeout = $xmlConfig.config.system.timeout.'#text'  foreach($task in $xmlConfig.config.tasks.task) {     $task.name   # \u0438\u043c\u044f \u043a\u043d\u043e\u043f\u043a\u0438     $task.script # \u0441\u043a\u0440\u0438\u043f\u0442 }<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"powershell\">[xml]$xmlConfig = Get-Content -Path (\"c:\\Temp\\Habr\\telegram_bot.xml\") $token = $xmlConfig.config.system.token $timeout = $xmlConfig.config.system.timeout.'#text'  # Telegram URLs $URL_get = \"https:\/\/api.telegram.org\/bot$token\/getUpdates\" $URL_set = \"https:\/\/api.telegram.org\/bot$token\/sendMessage\"  function getUpdates($URL) {     $json = Invoke-RestMethod -Uri $URL     $data = $json.result | Select-Object -Last 1     # \u041e\u0431\u043d\u0443\u043b\u044f\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435     $text = $null     $callback_data = $null      # \u041d\u0430\u0436\u0430\u0442\u0438\u0435 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443     if($data.callback_query)     {           $callback_data = $data.callback_query.data         $chat_id = $data.callback_query.from.id         $f_name = $data.callback_query.from.first_name         $l_name = $data.callback_query.from.last_name         $username = $data.callback_query.from.username     }     # \u041e\u0431\u044b\u0447\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435     elseif($data.message)     {         $chat_id = $data.message.chat.id         $text = $data.message.text         $f_name = $data.message.chat.first_name         $l_name = $data.message.chat.last_name         $type = $data.message.chat.type         $username = $data.message.chat.username     }      $ht = @{}     $ht[\"chat_id\"] = $chat_id     $ht[\"text\"] = $text     $ht[\"f_name\"] = $f_name     $ht[\"l_name\"] = $l_name     $ht[\"username\"] = $username     $ht[\"callback_data\"] = $callback_data     # confirm     Invoke-RestMethod \"$($URL)?offset=$($($data.update_id)+1)\" -Method Get | Out-Null          return $ht }  function sendMessage($URL, $chat_id, $text) {     # \u0441\u043e\u0437\u0434\u0430\u0435\u043c HashTable, \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0442\u044c \u0435\u0435 \u0438 \u0442\u0430\u043a\u0438\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c     $ht = @{         text = $text         # \u0443\u043a\u0430\u0437\u0430\u043d \u0441\u043f\u043e\u0441\u043e\u0431 \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438 Markdown         parse_mode = \"Markdown\"         chat_id = $chat_id     }     # \u0414\u0430\u043d\u043d\u044b\u0435 \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 json     $json = $ht | ConvertTo-Json     # \u0414\u0435\u043b\u0430\u0435\u043c \u0447\u0435\u0440\u0435\u0437 Invoke-RestMethod, \u043d\u043e \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u0437\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438 \u0447\u0435\u0440\u0435\u0437 Invoke-WebRequest     # Method Post - \u0442.\u043a. \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e Get     Invoke-RestMethod $URL -Method Post -ContentType 'application\/json; charset=utf-8' -Body $json | Out-Null    } function sendKeyboard($URL, $buttons, $chat_id, $text) {     $keyboard = @{\"inline_keyboard\" = @(,$buttons)}     $ht = @{          parse_mode = \"Markdown\"         reply_markup = $keyboard         chat_id = $chat_id         text = $text     }      $json = $ht | ConvertTo-Json -Depth 5     Invoke-RestMethod $URL -Method Post -ContentType 'application\/json; charset=utf-8' -Body $json      }  while($true) # \u0432\u0435\u0447\u043d\u044b\u0439 \u0446\u0438\u043a\u043b {     $return = getUpdates $URL_get      # \u0415\u0441\u043b\u0438 \u043e\u0431\u044b\u0447\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435     if($return.text)     {          # http:\/\/apps.timwhitlock.info\/emoji\/tables\/unicode#block-1-emoticons         #sendMessage $URL_set $return.chat_id (Get-Random(\"\", \"\", \"\", \"\"))         write-host \"$($return[\"chat_id\"])\"         switch -Wildcard ($return[\"text\"])         {             \"*\u043f\u0440\u0438\u0432\u0435\u0442*\" {                  # \u041f\u0443\u0441\u0442\u043e\u0439 \u043c\u0430\u0441\u0441\u0438\u0432                 $buttons = @()                 foreach($task in $xmlConfig.config.tasks.task)                 {                     $button = @{ \"text\" = $task.name; callback_data = $task.script}                     $buttons += $button                 }                                  $text = \"Available tasks:\"                 $chat_id = $return.chat_id                 sendKeyboard $URL_set $buttons $chat_id $text                 #sendMessage $URL_set $return.chat_id \"\u041f\u0440\u0438\u0432\u0435\u0442, $($return[\"f_name\"])\"              }             \"*\u043a\u0430\u043a \u0434\u0435\u043b\u0430?*\" { sendMessage $URL_set $return.chat_id \"\u0425\u043e\u0440\u043e\u0448\u043e\" }             default {sendMessage $URL_set $return.chat_id \"$(Get-Random(\"\", \"\", \"\", \"\"))\"}         }         }     # \u0435\u0441\u043b\u0438 \u0431\u044b\u043b\u043e \u043d\u0430\u0436\u0430\u0442\u0438\u0435 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443     elseif($return.callback_data)     {         sendMessage $URL_set $($return.chat_id) $($return.callback_data)     }     Start-Sleep -s $timeout }<\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u0435\u0441\u043b\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u00ab\u043f\u0440\u0438\u0432\u0435\u0442\u00bb \u2014 \u0431\u043e\u0442 \u0432\u0435\u0440\u043d\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u043a\u043d\u043e\u043f\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0437\u0430\u0434\u0430\u0447\u0430\u043c, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u043c \u0432 xml-\u0444\u0430\u0439\u043b\u044b. \u0412 callback_data \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0438\u043b\u0438 \u0441\u043a\u0440\u0438\u043f\u0442.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u043a\u043e\u0441\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u2013 \u0442\u043e \u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043a\u043d\u043e\u043f\u043e\u043a \u0431\u044b\u043b\u043e 3-4 \u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0443, \u0438\u043d\u0430\u0447\u0435 \u043e\u043d\u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0442\u0441\u044f \u043d\u0435 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/qo\/ou\/e_\/qooue_7hsolqk_36nwxicfs_kt0.jpeg\" alt=\"KeyBoard\"><\/p>\n<p>  \u0411\u0443\u0434\u0435\u043c \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e 3 \u043a\u043d\u043e\u043f\u043a\u0438 \u0432 \u043b\u0438\u043d\u0438\u044e (\u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e).<\/p>\n<p>  \u0421\u0445\u0435\u043c\u0430\u0442\u0438\u0447\u043d\u043e \u043c\u0430\u0441\u0441\u0438\u0432 keyboard \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/gc\/sf\/el\/gcsfelyplaffrofxzcjtpyovtuw.jpeg\" alt=\"Keyboard\"><\/p>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c: <br \/>  Button[i] \u2014 \u043c\u0430\u0441\u0441\u0438\u0432 (\u0430\u0441\u0441\u043e\u0446\u0438\u0430\u0442\u0438\u0432\u043d\u044b\u0439) \u0432\u0438\u0434\u0430 <\/p>\n<pre><code class=\"powershell\">$button = @{ \"text\" = $task.name; callback_data = $task.script}<\/code><\/pre>\n<p>  Line[1-3] \u2014 \u044d\u0442\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u044b (\u0438\u0437 \u043a\u043d\u043e\u043f\u043e\u043a), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0445\u0440\u0430\u043d\u044f\u0442 \u0432 \u0441\u0435\u0431\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u043a\u043d\u043e\u043f\u043e\u043a (\u044d\u0442\u043e \u0432\u0430\u0436\u043d\u043e)<br \/>  Keyboard \u2013 \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 Line\u2019\u043e\u0432.<\/p>\n<p>  \u041c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <i>sendKeyboard<\/i><\/p>\n<pre><code class=\"powershell\"> function sendKeyboard($URL, $buttons, $chat_id, $text) {         $keyboard = @{}     # \u0422\u0443\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c ArrayList, \u0442.\u043a \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0435\u0433\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b - \u0434\u0440\u0443\u0433\u0438\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u044b     $lines = 3           $buttons_line = New-Object System.Collections.ArrayList     for($i=0; $i -lt $buttons.Count; $i++)     {         # \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u043d\u043e\u043f\u043a\u0438 \u0432 \u043b\u0438\u043d\u0438\u044e (line). \u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 3 - \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c line \u0432 keyboard         $buttons_line.Add($buttons[$i]) | Out-Null         # \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0441\u0447\u0435\u0442\u0447\u0438\u043a - \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c 0         if( ($i + 1 )%$lines -eq 0 )         {             # \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u043a\u043d\u043e\u043f\u043e\u043a \u0432 keyboard             $keyboard[\"inline_keyboard\"] += @(,@($buttons_line))             $buttons_line.Clear()         }     }     # \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0435\u0441\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u043a\u043d\u043e\u043f\u043a\u0438     $keyboard[\"inline_keyboard\"] += @(,@($buttons_line))              #$keyboard = @{\"inline_keyboard\" = @(,$buttons)}     $ht = @{          parse_mode = \"Markdown\"         reply_markup = $keyboard         chat_id = $chat_id         text = $text     }     $json = $ht | ConvertTo-Json -Depth 5     Invoke-RestMethod $URL -Method Post -ContentType 'application\/json; charset=utf-8' -Body $json     }  <\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/de\/bm\/cu\/debmcuonvv9pedmpe0s6pfcik-y.jpeg\" alt=\"Keyboard_Telegram\"><\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0418\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"powershell\">[xml]$xmlConfig = Get-Content -Path (\"c:\\Temp\\Habr\\telegram_bot.xml\") $token = $xmlConfig.config.system.token $timeout = $xmlConfig.config.system.timeout.'#text'  # Telegram URLs $URL_get = \"https:\/\/api.telegram.org\/bot$token\/getUpdates\" $URL_set = \"https:\/\/api.telegram.org\/bot$token\/sendMessage\"    function getUpdates($URL) {     $json = Invoke-RestMethod -Uri $URL     $data = $json.result | Select-Object -Last 1     # \u041e\u0431\u043d\u0443\u043b\u044f\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435     $text = $null     $callback_data = $null      # \u041d\u0430\u0436\u0430\u0442\u0438\u0435 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443     if($data.callback_query)     {           $callback_data = $data.callback_query.data         $chat_id = $data.callback_query.from.id         $f_name = $data.callback_query.from.first_name         $l_name = $data.callback_query.from.last_name         $username = $data.callback_query.from.username     }     # \u041e\u0431\u044b\u0447\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435     elseif($data.message)     {         $chat_id = $data.message.chat.id         $text = $data.message.text         $f_name = $data.message.chat.first_name         $l_name = $data.message.chat.last_name         $type = $data.message.chat.type         $username = $data.message.chat.username     }      $ht = @{}     $ht[\"chat_id\"] = $chat_id     $ht[\"text\"] = $text     $ht[\"f_name\"] = $f_name     $ht[\"l_name\"] = $l_name     $ht[\"username\"] = $username     $ht[\"callback_data\"] = $callback_data     # confirm     Invoke-RestMethod \"$($URL)?offset=$($($data.update_id)+1)\" -Method Get | Out-Null          return $ht }  function sendMessage($URL, $chat_id, $text) {     # \u0441\u043e\u0437\u0434\u0430\u0435\u043c HashTable, \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0442\u044c \u0435\u0435 \u0438 \u0442\u0430\u043a\u0438\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c     $ht = @{         text = $text         # \u0443\u043a\u0430\u0437\u0430\u043d \u0441\u043f\u043e\u0441\u043e\u0431 \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438 Markdown         parse_mode = \"Markdown\"         chat_id = $chat_id     }     # \u0414\u0430\u043d\u043d\u044b\u0435 \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 json     $json = $ht | ConvertTo-Json     # \u0414\u0435\u043b\u0430\u0435\u043c \u0447\u0435\u0440\u0435\u0437 Invoke-RestMethod, \u043d\u043e \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u0437\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438 \u0447\u0435\u0440\u0435\u0437 Invoke-WebRequest     # Method Post - \u0442.\u043a. \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e Get     Invoke-RestMethod $URL -Method Post -ContentType 'application\/json; charset=utf-8' -Body $json | Out-Null    } function sendKeyboard($URL, $buttons, $chat_id, $text) {          $keyboard = @{}     # \u0422\u0443\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c ArrayList, \u0442.\u043a \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0435\u0433\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b - \u0434\u0440\u0443\u0433\u0438\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u044b \t$lines = 3       $buttons_line = New-Object System.Collections.ArrayList     for($i=0; $i -lt $buttons.Count; $i++)     {         # \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u043d\u043e\u043f\u043a\u0438 \u0432 \u043b\u0438\u043d\u0438\u044e (line). \u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 3 - \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c line \u0432 keyboard         $buttons_line.Add($buttons[$i]) | Out-Null         # \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0441\u0447\u0435\u0442\u0447\u0438\u043a - \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c 0         if( ($i + 1 )%$lines -eq 0 )         {             # \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u043a\u043d\u043e\u043f\u043e\u043a \u0432 keyboard             $keyboard[\"inline_keyboard\"] += @(,@($buttons_line))             $buttons_line.Clear()         }     }     # \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0435\u0441\u044f \u043f\u043e\u0441\u043b\u0435\u043d\u0438\u0435 \u043a\u043d\u043e\u043f\u043a\u0438     $keyboard[\"inline_keyboard\"] += @(,@($buttons_line))      $ht = @{          parse_mode = \"Markdown\"         reply_markup = $keyboard         chat_id = $chat_id         text = $text     }      $json = $ht | ConvertTo-Json -Depth 5     Invoke-RestMethod $URL -Method Post -ContentType 'application\/json; charset=utf-8' -Body $json      }  while($true) # \u0432\u0435\u0447\u043d\u044b\u0439 \u0446\u0438\u043a\u043b {     $return = getUpdates $URL_get     #$return.text = \"\u043f\u0440\u0438\u0432\u0435\u0442\"     # \u0415\u0441\u043b\u0438 \u043e\u0431\u044b\u0447\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435     if($return.text)     {          # http:\/\/apps.timwhitlock.info\/emoji\/tables\/unicode#block-1-emoticons         #sendMessage $URL_set $return.chat_id (Get-Random(\"\", \"\", \"\", \"\"))         switch -Wildcard ($return[\"text\"])         {             \"*\u043f\u0440\u0438\u0432\u0435\u0442*\" {                  # \u041f\u0443\u0441\u0442\u043e\u0439 \u043c\u0430\u0441\u0441\u0438\u0432                 $buttons = @()                 foreach($task in $xmlConfig.config.tasks.task)                 {                     $i++                     $button = @{ \"text\" = $task.name; callback_data = $task.script}                     $buttons += $button                 }                                  $text = \"Available tasks:\"                 $chat_id = $return.chat_id                 sendKeyboard $URL_set $buttons $chat_id $text                 #sendMessage $URL_set $return.chat_id \"\u041f\u0440\u0438\u0432\u0435\u0442, $($return[\"f_name\"])\"              }             \"*\u043a\u0430\u043a \u0434\u0435\u043b\u0430?*\" { sendMessage $URL_set $return.chat_id \"\u0425\u043e\u0440\u043e\u0448\u043e\" }             default {sendMessage $URL_set $return.chat_id \"$(Get-Random(\"\", \"\", \"\", \"\"))\"}         }         }     # \u0435\u0441\u043b\u0438 \u0431\u044b\u043b\u043e \u043d\u0430\u0436\u0430\u0442\u0438\u0435 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443     elseif($return.callback_data)     {         #sendMessage $URL_set $($return.chat_id) $($return.callback_data)         write-host \"$($return.chat_id) $($return.callback_data)\"     }     Start-Sleep -s $timeout } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h3>\u0427\u0430\u0441\u0442\u044c 4: \u0437\u0430\u0434\u0430\u0447\u043d\u043e\u0441\u0442\u044c \u0438 \u043c\u043d\u043e\u0433\u043e\u0437\u0430\u0434\u0430\u0447\u043d\u043e\u0441\u0442\u044c<\/h3>\n<p>  \u041d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u043e \u043a\u043d\u043e\u043f\u043a\u0435 \u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0435\u043b\u0430. <\/p>\n<p>  \u0414\u043b\u044f \u043c\u043d\u043e\u0433\u043e\u0437\u0430\u0434\u0430\u0447\u043d\u043e\u0441\u0442\u0438 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c Job\u2019\u043e\u0432. \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0442\u0430\u043a\u043e\u0439 \u043a\u0443\u0441\u043e\u043a \u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"powershell\">$script = \"ipconfig\" $script_block = { Param($script) ; Invoke-Expression $script } $job_name = \"TestJob\" Start-Job -ScriptBlock $script_block -ArgumentList $script -Name $job_name | Out-Null <\/code><\/pre>\n<p>  \u0418 \u0447\u0435\u0440\u0435\u0437 5 \u0441\u0435\u043a\u0443\u043d\u0434 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c:  <\/p>\n<pre><code class=\"powershell\"> foreach($job in (Get-Job | Where {$_.State -eq \"Completed\"} )) {     $output = Get-Job -ID $job.Id | Receive-Job     $output     $job | Remove-Job }  <\/code><\/pre>\n<p>  <i>$output <\/i> \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c ipconfig \u0441 localhost<\/p>\n<p>  \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u044d\u0442\u043e \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442, \u0432 \u0431\u043b\u043e\u043a callback_data<\/p>\n<pre><code class=\"powershell\"># \u0435\u0441\u043b\u0438 \u0431\u044b\u043b\u043e \u043d\u0430\u0436\u0430\u0442\u0438\u0435 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443     elseif($return.callback_data)     {         $script = $($return.callback_data)         $job_name = $($return.chat_id)          $script_block = { Param($script) ; Invoke-Expression $script }           #\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c Job         Start-Job -ScriptBlock $script_block -ArgumentList $script -Name $job_name | Out-Null              }<\/code><\/pre>\n<p>  \u0410 \u044d\u0442\u043e \u043d\u0438\u0436\u0435<\/p>\n<pre><code class=\"powershell\">         # \u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a\u0438\u0435 job'\u044b \u0443\u0436\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b\u0438\u0441\u044c         foreach($job in (Get-Job | Where {$_.State -eq \"Completed\"} ))         {                          $output = Get-Job -ID $job.Id | Receive-Job                    # \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0442\u043e\u043c\u0443, \u043a\u0442\u043e \u0432\u044b\u0437\u0432\u0430\u043b job             sendMessage $URL_set $job.Name $output              $job | Remove-Job              # \u0438 \u0441\u043d\u043e\u0432\u0430 \u0448\u043b\u0435\u043c \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0443             $text = \"Available tasks:\"             sendKeyboard $URL_set $buttons $job.Name $text         } <\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u043b\u043e\u0432\u0438\u043c error<br \/>  <i>Invoke-RestMethod: {\u00abok\u00bb:false,\u00aberror_code\u00bb:400,\u00abdescription\u00bb:\u00abBad Request: message is too long\u00bb}<\/i> <\/p>\n<p>  \u041d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u0440\u0430\u0445 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e, \u0447\u0442\u043e \u0434\u043b\u0438\u043d\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0442\u044c 4096 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432. \u041e\u0443\u043a\u0435\u0439\u2026<\/p>\n<pre><code class=\"powershell\">$output.Length<\/code><\/pre>\n<p> \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u0447\u0442\u043e \u0434\u043b\u0438\u043d\u0430 39<br \/>  \u0414\u043e\u043b\u0433\u043e \u0434\u0443\u043c\u0430\u0435\u043c \u0447\u0442\u043e \u043d\u0435 \u0442\u0430\u043a, \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0442\u0430\u043a\u043e\u0439 \u043a\u0443\u0441\u043e\u043a \u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"powershell\">$text = $null foreach($string in $output) {     $text = \"$text`n$string\" }  sendMessage $URL_set $job.Name $text <\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u043e\u0431\u0443\u0435\u043c \u0432\u0441\u0451 \u0432\u043c\u0435\u0441\u0442\u0435<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"powershell\">[xml]$xmlConfig = Get-Content -Path (\"c:\\Temp\\Habr\\telegram_bot.xml\") $token = $xmlConfig.config.system.token $timeout = $xmlConfig.config.system.timeout.'#text'  # Telegram URLs $URL_get = \"https:\/\/api.telegram.org\/bot$token\/getUpdates\" $URL_set = \"https:\/\/api.telegram.org\/bot$token\/sendMessage\"    function getUpdates($URL) {     $json = Invoke-RestMethod -Uri $URL     $data = $json.result | Select-Object -Last 1     # \u041e\u0431\u043d\u0443\u043b\u044f\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435     $text = $null     $callback_data = $null      # \u041d\u0430\u0436\u0430\u0442\u0438\u0435 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443     if($data.callback_query)     {           $callback_data = $data.callback_query.data         $chat_id = $data.callback_query.from.id         $f_name = $data.callback_query.from.first_name         $l_name = $data.callback_query.from.last_name         $username = $data.callback_query.from.username     }     # \u041e\u0431\u044b\u0447\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435     elseif($data.message)     {         $chat_id = $data.message.chat.id         $text = $data.message.text         $f_name = $data.message.chat.first_name         $l_name = $data.message.chat.last_name         $type = $data.message.chat.type         $username = $data.message.chat.username     }      $ht = @{}     $ht[\"chat_id\"] = $chat_id     $ht[\"text\"] = $text     $ht[\"f_name\"] = $f_name     $ht[\"l_name\"] = $l_name     $ht[\"username\"] = $username     $ht[\"callback_data\"] = $callback_data     # confirm     Invoke-RestMethod \"$($URL)?offset=$($($data.update_id)+1)\" -Method Get | Out-Null          return $ht } function sendMessage($URL, $chat_id, $text) {     # \u0441\u043e\u0437\u0434\u0430\u0435\u043c HashTable, \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0442\u044c \u0435\u0435 \u0438 \u0442\u0430\u043a\u0438\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c     $ht = @{         text = $text         # \u0443\u043a\u0430\u0437\u0430\u043d \u0441\u043f\u043e\u0441\u043e\u0431 \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438 Markdown         parse_mode = \"Markdown\"         chat_id = $chat_id     }     # \u0414\u0430\u043d\u043d\u044b\u0435 \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 json     $json = $ht | ConvertTo-Json     # \u0414\u0435\u043b\u0430\u0435\u043c \u0447\u0435\u0440\u0435\u0437 Invoke-RestMethod, \u043d\u043e \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u0437\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438 \u0447\u0435\u0440\u0435\u0437 Invoke-WebRequest     # Method Post - \u0442.\u043a. \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e Get     Invoke-RestMethod $URL -Method Post -ContentType 'application\/json; charset=utf-8' -Body $json | Out-Null } function sendKeyboard($URL, $buttons, $chat_id, $text) {          $keyboard = @{}     $lines = 3     # \u0422\u0443\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c ArrayList, \u0442.\u043a \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0435\u0433\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b - \u0434\u0440\u0443\u0433\u0438\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u044b     $buttons_line = New-Object System.Collections.ArrayList     for($i=0; $i -lt $buttons.Count; $i++)     {         # \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u043d\u043e\u043f\u043a\u0438 \u0432 \u043b\u0438\u043d\u0438\u044e (line). \u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 3 - \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c line \u0432 keyboard         $buttons_line.Add($buttons[$i]) | Out-Null         # \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0441\u0447\u0435\u0442\u0447\u0438\u043a - \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c 0         if( ($i + 1 )%$lines -eq 0 )         {             # \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u043a\u043d\u043e\u043f\u043e\u043a \u0432 keyboard             $keyboard[\"inline_keyboard\"] += @(,@($buttons_line))             $buttons_line.Clear()         }     }     # \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0435\u0441\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u043a\u043d\u043e\u043f\u043a\u0438     $keyboard[\"inline_keyboard\"] += @(,@($buttons_line))      $ht = @{          parse_mode = \"Markdown\"         reply_markup = $keyboard         chat_id = $chat_id         text = $text     }      $json = $ht | ConvertTo-Json -Depth 5     Invoke-RestMethod $URL -Method Post -ContentType 'application\/json; charset=utf-8' -Body $json      }  while($true) # \u0432\u0435\u0447\u043d\u044b\u0439 \u0446\u0438\u043a\u043b {     $return = getUpdates $URL_get     #$return.text = \"\u043f\u0440\u0438\u0432\u0435\u0442\"     # \u0415\u0441\u043b\u0438 \u043e\u0431\u044b\u0447\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435     if($return.text)     {          # http:\/\/apps.timwhitlock.info\/emoji\/tables\/unicode#block-1-emoticons         #sendMessage $URL_set $return.chat_id (Get-Random(\"\", \"\", \"\", \"\"))         switch -Wildcard ($return[\"text\"])         {             \"*\u043f\u0440\u0438\u0432\u0435\u0442*\" {                  # \u041f\u0443\u0441\u0442\u043e\u0439 \u043c\u0430\u0441\u0441\u0438\u0432                 $buttons = @()                 foreach($task in $xmlConfig.config.tasks.task)                 {                     $i++                     $button = @{ \"text\" = $task.name; callback_data = $task.script}                     $buttons += $button                 }                                  $text = \"Available tasks:\"                 $chat_id = $return.chat_id                 sendKeyboard $URL_set $buttons $chat_id $text                 #sendMessage $URL_set $return.chat_id \"\u041f\u0440\u0438\u0432\u0435\u0442, $($return[\"f_name\"])\"              }             \"*\u043a\u0430\u043a \u0434\u0435\u043b\u0430?*\" { sendMessage $URL_set $return.chat_id \"\u0425\u043e\u0440\u043e\u0448\u043e\" }             default {sendMessage $URL_set $return.chat_id \"$(Get-Random(\"\", \"\", \"\", \"\"))\"}         }         }          # \u0435\u0441\u043b\u0438 \u0431\u044b\u043b\u043e \u043d\u0430\u0436\u0430\u0442\u0438\u0435 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443         elseif($return.callback_data)         {             $script = $($return.callback_data)             $job_name = $($return.chat_id)             write-host \"$script $job_name\"              $script_block = { Param($script) ; Invoke-Expression $script }              #\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c Job             Start-Job -ScriptBlock $script_block -ArgumentList $script -Name $job_name | Out-Null         }          # \u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a\u0438\u0435 job'\u044b \u0443\u0436\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b\u0438\u0441\u044c         foreach($job in (Get-Job | Where {$_.State -eq \"Completed\"} ))         {                          $output = Get-Job -ID $job.Id | Receive-Job                    $text = $null             foreach($string in $output)             {                 $text = \"$text`n$string\"             }             # \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0442\u043e\u043c\u0443, \u043a\u0442\u043e \u0432\u044b\u0437\u0432\u0430\u043b job             sendMessage $URL_set $job.Name $text              $job | Remove-Job              # \u0438 \u0441\u043d\u043e\u0432\u0430 \u0448\u043b\u0435\u043c \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0443             $text = \"Available tasks:\"             sendKeyboard $URL_set $buttons $job.Name $text         }      Start-Sleep -s $timeout } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/uc\/0j\/tj\/uc0jtjsbxbvszrfqikmiebepq3m.jpeg\" alt=\"Output\"><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u043a\u0440\u0443\u0442\u0438\u043c \u00ab\u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438\u00bb<\/p>\n<p>  \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 xml \u043a\u043e\u043d\u0444\u0438\u0433 \u043d\u043e\u0432\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443, \u043d\u0430\u0437\u043e\u0432\u0435\u043c \u0435\u0435 <i>users <\/i> \u0438 \u0443\u043a\u0430\u0436\u0435\u043c \u0442\u0430\u043c chat_id \u0442\u0435\u0445, \u043a\u043e\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0449\u0430\u0442\u044c\u0441\u044f \u0441 \u0431\u043e\u0442\u043e\u043c:<\/p>\n<pre><code class=\"xml\">\t&lt;system&gt; \t\t&lt;token&gt;610373243:AAF7Z0HnruKYsPwtkuupi01XqVOV-PtXgFM&lt;\/token&gt; \t\t&lt;timeout desc=\"bot check timeout in seconds\"&gt;1&lt;\/timeout&gt; \t\t&lt;users&gt;111111111, 222222222&lt;\/users&gt; \t&lt;\/system&gt;<\/code><\/pre>\n<p>  \u0412 \u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 <i>users<\/i><\/p>\n<pre><code class=\"powershell\">$users = (($xmlConfig.config.system.users).Split(\",\")).Trim() <\/code><\/pre>\n<p>  \u0418 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c<\/p>\n<pre><code class=\"powershell\">     if($users -contains $return.chat_id)     {  ...     }<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043a\u0440\u0438\u043f\u0442 \u0446\u0435\u043b\u0438\u043a\u043e\u043c<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"powershell\">[xml]$xmlConfig = Get-Content -Path (\"c:\\Temp\\Habr\\telegram_bot.xml\") $token = $xmlConfig.config.system.token $timeout = $xmlConfig.config.system.timeout.'#text' $users = (($xmlConfig.config.system.users).Split(\",\")).Trim()  # Telegram URLs $URL_get = \"https:\/\/api.telegram.org\/bot$token\/getUpdates\" $URL_set = \"https:\/\/api.telegram.org\/bot$token\/sendMessage\"  function getUpdates($URL) {     $json = Invoke-RestMethod -Uri $URL     $data = $json.result | Select-Object -Last 1     # \u041e\u0431\u043d\u0443\u043b\u044f\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435     $text = $null     $callback_data = $null      # \u041d\u0430\u0436\u0430\u0442\u0438\u0435 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443     if($data.callback_query)     {           $callback_data = $data.callback_query.data         $chat_id = $data.callback_query.from.id         $f_name = $data.callback_query.from.first_name         $l_name = $data.callback_query.from.last_name         $username = $data.callback_query.from.username     }     # \u041e\u0431\u044b\u0447\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435     elseif($data.message)     {         $chat_id = $data.message.chat.id         $text = $data.message.text         $f_name = $data.message.chat.first_name         $l_name = $data.message.chat.last_name         $type = $data.message.chat.type         $username = $data.message.chat.username     }      $ht = @{}     $ht[\"chat_id\"] = $chat_id     $ht[\"text\"] = $text     $ht[\"f_name\"] = $f_name     $ht[\"l_name\"] = $l_name     $ht[\"username\"] = $username     $ht[\"callback_data\"] = $callback_data     # confirm     Invoke-RestMethod \"$($URL)?offset=$($($data.update_id)+1)\" -Method Get | Out-Null          return $ht } function sendMessage($URL, $chat_id, $text) {     # \u0441\u043e\u0437\u0434\u0430\u0435\u043c HashTable, \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0442\u044c \u0435\u0435 \u0438 \u0442\u0430\u043a\u0438\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c     $ht = @{         text = $text         # \u0443\u043a\u0430\u0437\u0430\u043d \u0441\u043f\u043e\u0441\u043e\u0431 \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438 Markdown         parse_mode = \"Markdown\"         chat_id = $chat_id     }     # \u0414\u0430\u043d\u043d\u044b\u0435 \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 json     $json = $ht | ConvertTo-Json     # \u0414\u0435\u043b\u0430\u0435\u043c \u0447\u0435\u0440\u0435\u0437 Invoke-RestMethod, \u043d\u043e \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u0437\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438 \u0447\u0435\u0440\u0435\u0437 Invoke-WebRequest     # Method Post - \u0442.\u043a. \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e Get     Invoke-RestMethod $URL -Method Post -ContentType 'application\/json; charset=utf-8' -Body $json | Out-Null } function sendKeyboard($URL, $buttons, $chat_id, $text) {          $keyboard = @{}     $lines = 3     # \u0422\u0443\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c ArrayList, \u0442.\u043a \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0435\u0433\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b - \u0434\u0440\u0443\u0433\u0438\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u044b     $buttons_line = New-Object System.Collections.ArrayList     for($i=0; $i -lt $buttons.Count; $i++)     {         # \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u043d\u043e\u043f\u043a\u0438 \u0432 \u043b\u0438\u043d\u0438\u044e (line). \u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 3 - \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c line \u0432 keyboard         $buttons_line.Add($buttons[$i]) | Out-Null         # \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0441\u0447\u0435\u0442\u0447\u0438\u043a - \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c 0         if( ($i + 1 )%$lines -eq 0 )         {             # \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u043a\u043d\u043e\u043f\u043e\u043a \u0432 keyboard             $keyboard[\"inline_keyboard\"] += @(,@($buttons_line))             $buttons_line.Clear()         }     }     # \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0435\u0441\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u043a\u043d\u043e\u043f\u043a\u0438     $keyboard[\"inline_keyboard\"] += @(,@($buttons_line))      $ht = @{          parse_mode = \"Markdown\"         reply_markup = $keyboard         chat_id = $chat_id         text = $text     }      $json = $ht | ConvertTo-Json -Depth 5     Invoke-RestMethod $URL -Method Post -ContentType 'application\/json; charset=utf-8' -Body $json      }  while($true) # \u0432\u0435\u0447\u043d\u044b\u0439 \u0446\u0438\u043a\u043b {     $return = getUpdates $URL_get          if($users -contains $return.chat_id)     {          # \u0415\u0441\u043b\u0438 \u043e\u0431\u044b\u0447\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435         if($return.text)         {             #write-host $return.chat_id             # http:\/\/apps.timwhitlock.info\/emoji\/tables\/unicode#block-1-emoticons             #sendMessage $URL_set $return.chat_id (Get-Random(\"\", \"\", \"\", \"\"))             switch -Wildcard ($return[\"text\"])             {                 \"*\u043f\u0440\u0438\u0432\u0435\u0442*\" {                      # \u041f\u0443\u0441\u0442\u043e\u0439 \u043c\u0430\u0441\u0441\u0438\u0432                     $buttons = @()                     foreach($task in $xmlConfig.config.tasks.task)                     {                         $i++                         $button = @{ \"text\" = $task.name; callback_data = $task.script}                         $buttons += $button                     }                                      $text = \"Available tasks:\"                     $chat_id = $return.chat_id                     sendKeyboard $URL_set $buttons $chat_id $text                     #sendMessage $URL_set $return.chat_id \"\u041f\u0440\u0438\u0432\u0435\u0442, $($return[\"f_name\"])\"                  }                 \"*\u043a\u0430\u043a \u0434\u0435\u043b\u0430?*\" { sendMessage $URL_set $return.chat_id \"\u0425\u043e\u0440\u043e\u0448\u043e\" }                 default {sendMessage $URL_set $return.chat_id \"$(Get-Random(\"\", \"\", \"\", \"\"))\"}             }             }         # \u0435\u0441\u043b\u0438 \u0431\u044b\u043b\u043e \u043d\u0430\u0436\u0430\u0442\u0438\u0435 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443         elseif($return.callback_data)         {             $script = $($return.callback_data)             $job_name = $($return.chat_id)             write-host \"$script $job_name\"              $script_block = { Param($script) ; Invoke-Expression $script }              #\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c Job             Start-Job -ScriptBlock $script_block -ArgumentList $script -Name $job_name | Out-Null         }          # \u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a\u0438\u0435 job'\u044b \u0443\u0436\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b\u0438\u0441\u044c         foreach($job in (Get-Job | Where {$_.State -eq \"Completed\"} ))         {                          $output = Get-Job -ID $job.Id | Receive-Job                    $text = $null             foreach($string in $output)             {                 $text = \"$text`n$string\"             }             # \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0442\u043e\u043c\u0443, \u043a\u0442\u043e \u0432\u044b\u0437\u0432\u0430\u043b job             sendMessage $URL_set $job.Name $text              $job | Remove-Job              # \u0438 \u0441\u043d\u043e\u0432\u0430 \u0448\u043b\u0435\u043c \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0443             $text = \"Available tasks:\"             sendKeyboard $URL_set $buttons $job.Name $text         }       }     else     {         if($return.text)         {             sendMessage $URL_set $return.chat_id \"\u0412\u044b \u043a\u0442\u043e \u0442\u0430\u043a\u0438\u0435? \u042f \u0432\u0430\u0441 \u043d\u0435 \u0437\u0432\u0430\u043b!\"         }     }     Start-Sleep -s $timeout }<\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h3>\u0427\u0430\u0441\u0442\u044c 5: \u0432 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0431\u043e\u0442\u0430 \u2013 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0442\u0443\u0434\u0430 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0435<br \/>  \u0414\u043b\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u043d\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c Invoke-Command \u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c Write-Output<\/p>\n<pre><code class=\"powershell\">$hostname = \"hostname\" $service = \"MSSQLSERVER\" $output = Invoke-Command -ComputerName $hostname -ScriptBlock{param($service); (Get-Service -Name $service).Status} -ArgumentList $service  write-output $output.Value <\/code><\/pre>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0443\u0447\u0435\u0442\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c, \u0438\u0437-\u043f\u043e\u0434 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c-\u0431\u043e\u0442\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0438\u043c\u0435\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043f\u0440\u0438\u0432\u0438\u043b\u0435\u0433\u0438\u0438 \u043d\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435.<\/p>\n<p>  \u0422\u0430\u043a\u0436\u0435, \u044f \u043d\u0435 \u0437\u0430\u0442\u0440\u043e\u043d\u0443\u043b \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u044f, \u043d\u043e \u0437\u0434\u0435\u0441\u044c, \u0434\u0443\u043c\u0430\u044e, \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e, \u043f\u043e \u0436\u0435\u043b\u0430\u043d\u0438\u044e \u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u0430\u043c \u043c\u043e\u0436\u0435\u0442 \u0440\u0435\u0448\u0438\u0442\u044c \u0447\u0442\u043e \u043e\u043d \u0445\u043e\u0447\u0435\u0442 \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0430 \u0447\u0442\u043e \u043d\u0435\u0442.<\/p>\n<p>  \u041d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u0443 \u043a\u043e\u0433\u043e-\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u043e\u0439 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f &gt; 4096 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432, \u043d\u043e \u044d\u0442\u043e \u0440\u0435\u0448\u0430\u0435\u043c\u043e Substring \u0438 \u0446\u0438\u043a\u043b\u043e\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438.<\/p>\n<p>  \u0418 \u043d\u0430\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u043a \u2013 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438\u0437 \u043b\u044e\u0431\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u043c\u0438\u0440\u0430 (\u043f\u043e\u0447\u0442\u0438 \u0438\u0437 \u043b\u044e\u0431\u043e\u0439) \u044d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u043e, \u043d\u043e \u0432\u0441\u0435\u0433\u0434\u0430 \u0435\u0441\u0442\u044c \u0440\u0438\u0441\u043a, \u0447\u0442\u043e \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u0439\u0434\u0435\u0442 \u043d\u0435 \u0442\u0430\u043a (\u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0431\u043e\u0442\u043e\u043c \u0432\u0434\u0440\u0443\u0433 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u0442\u043e-\u0442\u043e \u043d\u0435\u0445\u043e\u0440\u043e\u0448\u0438\u0439). \u041d\u0430 \u044d\u0442\u043e\u0442 \u0441\u043b\u0443\u0447\u0430\u0439 \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 Exit \u0438\u0437 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043f\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u0441\u043b\u043e\u0432\u0443<\/p>\n<pre><code class=\"powershell\">             switch -Wildcard ($return[\"text\"])             {                 \"*\u043f\u0440\u0438\u0432\u0435\u0442*\" {                      # \u041f\u0443\u0441\u0442\u043e\u0439 \u043c\u0430\u0441\u0441\u0438\u0432                     $buttons = @()                     foreach($task in $xmlConfig.config.tasks.task)                     {                         $i++                         $button = @{ \"text\" = $task.name; callback_data = $task.script}                         $buttons += $button                     }                                      $text = \"Available tasks:\"                     $chat_id = $return.chat_id                     sendKeyboard $URL_set $buttons $chat_id $text                     #sendMessage $URL_set $return.chat_id \"\u041f\u0440\u0438\u0432\u0435\u0442, $($return[\"f_name\"])\"                  }                 \"*\u043a\u0430\u043a \u0434\u0435\u043b\u0430?*\" { sendMessage $URL_set $return.chat_id \"\u0425\u043e\u0440\u043e\u0448\u043e\" }                 \"\u0430\u043b\u044f\u0440\u043c\u0430!\" {sendMessage $URL_set $return.chat_id \"bb\" ; Exit}                 default {sendMessage $URL_set $return.chat_id \"$(Get-Random(\"\", \"\", \"\", \"\"))\"}             }   <\/code><\/pre>\n<p>  \u0423 \u043c\u0435\u043d\u044f \u0432\u0441\u0451.<\/div>\n<p>               <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d() } } }t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>      <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\/post\/483660\/\"> https:\/\/habr.com\/ru\/post\/483660\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/483660\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/f-\/dc\/ax\/f-dcaxuxg0id5fqzmenau-wyi4c.jpeg\" alt=\"image\"><\/p>\n<p>  \u041f\u043e \u043c\u043e\u0442\u0438\u0432\u0430\u043c \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/317906\/\">\u0422\u0435\u043b\u0435\u0433\u0440\u0430\u043c\u043c-\u0431\u043e\u0442 \u0434\u043b\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430 <\/a> (\u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0435 \u043c\u043e\u044f, \u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043b) \u0437\u0430\u0445\u043e\u0442\u0435\u043b \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u043e\u043f\u044b\u0442\u043e\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f Telegram-\u0431\u043e\u0442\u0430 \u043d\u0430 PowerShell \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u043c\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u0411\u0443\u0434\u0435\u0442 \u0442\u0435\u043a\u0441\u0442, \u043a\u043e\u0434 \u0438 \u043d\u0435\u043c\u043d\u043e\u0436\u043a\u043e \u043a\u0430\u0440\u0442\u0438\u043d\u043e\u043a. \u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u0438\u0432\u043d\u0430\u044f \u043a\u0440\u0438\u0442\u0438\u043a\u0430 \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442\u0441\u044f ( \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0437\u0432\u0443\u0447\u0430\u043b\u043e \u00ab\u0437\u0430\u0447\u0435\u043c \u043d\u0430 PowerShell? \u041d\u0430\u0434\u043e \u0431\u044b\u043b\u043e \u043d\u0430 perl\u00bb ).<\/p>\n<p>  \u0414\u0443\u043c\u0430\u044e \u0447\u0442\u043e \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442 \u00ab\u043d\u043e\u0432\u0438\u0447\u043a\u0430\u043c\u00bb \u0432 PowerShell, \u043d\u043e \u0438 \u043e\u043f\u044b\u0442\u043d\u044b\u0435 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u044b \u043c\u043e\u0433\u0443\u0442 \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0435 \u0437\u0434\u0435\u0441\u044c \u0443\u0432\u0438\u0434\u0435\u0442\u044c.<\/p>\n<p>  \u0421\u0430\u043c\u0443 \u0441\u0442\u0430\u0442\u044c\u044e \u0441\u0442\u0430\u0440\u0430\u043b\u0441\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u043e \u0447\u0430\u0441\u0442\u044f\u043c \u2013 \u043e\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043a \u0441\u043b\u043e\u0436\u043d\u043e\u043c\u0443. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u0442\u0441\u044f \u043f\u043b\u0430\u0433\u0438\u0430\u0442, \u0431\u0443\u0434\u044c\u0442\u0435 \u0431\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u044b!<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c\u0438 \u0438\u043b\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445 (\u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c), \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043b\u043e\u0433\u0438 \u0438 \u0435\u0449\u0435 \u043a\u0430\u043a\u0443\u044e-\u0442\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438. \u0412\u0441\u0451 \u044d\u0442\u043e \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0434\u0435\u043b\u0430\u0442\u044c (\u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043d\u0435\u0442), \u043d\u0430\u0445\u043e\u0434\u044f\u0441\u044c \u0432 \u043c\u0435\u0442\u0440\u043e, \u0432 \u043c\u0430\u0433\u0430\u0437\u0438\u043d\u0435 \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 \u043b\u0451\u0436\u0430 \u043d\u0430 \u0434\u0438\u0432\u0430\u043d\u0435, \u0431\u0435\u0437 VPN \u0438 \u043d\u043e\u0443\u0442\u0431\u0443\u043a\u043e\u0432. \u0418\u0437 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0439 (\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u044b, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043d\u0430 \u043a\u043e\u043b\u0435\u043d\u043a\u0435).<\/p>\n<ul>\n<li>\u041f\u0440\u043e\u0441\u0442\u043e\u0442\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f\/\u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447 \u0432 Telegram-\u0431\u043e\u0442<\/li>\n<li>\u041c\u043d\u043e\u0433\u043e\u0437\u0430\u0434\u0430\u0447\u043d\u043e\u0441\u0442\u044c \u0438\u043b\u0438 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0437\u0430\u0446\u0438\u044f <\/li>\n<li>\u00ab\u041f\u043e\u043d\u044f\u0442\u043d\u044b\u0439\u00bb \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f<\/li>\n<li>\u0425\u043e\u0442\u044c \u043a\u0430\u043a\u0430\u044f-\u0442\u043e \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c<\/li>\n<\/ul>\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-297023","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/297023","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=297023"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/297023\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=297023"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=297023"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=297023"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}