{"id":264135,"date":"2015-08-24T11:35:02","date_gmt":"2015-08-24T07:35:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=264135"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=264135","title":{"rendered":"Wake on Lan \u0431\u043e\u0442 \u0434\u043b\u044f Telegram"},"content":{"rendered":"<p>             \u041f\u043e\u0441\u043b\u0435 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f <a href=\"https:\/\/core.telegram.org\/bots\/api\">API \u0431\u043e\u0442\u043e\u0432<\/a> \u0434\u043b\u044f Telegram \u0438\u0445 \u043f\u043e\u043f\u0443\u043b\u044f\u0446\u0438\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u0442\u0440\u0435\u043c\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u0442\u0438. \u042f \u0440\u0435\u0448\u0438\u043b \u043d\u0435 \u043e\u0442\u0441\u0442\u0430\u0432\u0430\u0442\u044c \u0438 \u043e\u0431\u0437\u0430\u0432\u0435\u0441\u0442\u0438\u0441\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u0434\u043b\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440. \u0414\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0431\u044b\u043b \u0432\u044b\u0431\u0440\u0430\u043d \u044f\u0437\u044b\u043a C#, \u0430 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0445\u043e\u0441\u0442\u0438\u043d\u0433\u0430 \u0432\u044b\u0431\u043e\u0440 \u043f\u0430\u043b \u043d\u0430 Azure.<\/p>\n<h4><b>\u0417\u0430\u0434\u0430\u0447\u0430<\/b><\/h4>\n<p> \u041d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0431\u043e\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u00ab\u043c\u0430\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u0430\u043a\u0435\u0442\u044b\u00bb \u0434\u043b\u044f \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430 \u043d\u0430 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 \u0438 \u043f\u043e\u0440\u0442.<\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u043d\u0435 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0442\u043e\u043a\u0435\u043d\u0430 \u0434\u043b\u044f \u0431\u043e\u0442\u0430 \u0438 \u0434\u0435\u043f\u043b\u043e\u0439 \u0441\u0430\u0439\u0442\u0430 \u043d\u0430 Azure. \u041d\u0430 \u044d\u0442\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0431\u0435\u0437 \u0442\u0440\u0443\u0434\u0430 <a href=\"http:\/\/habrahabr.ru\/post\/262247\/\">\u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u0445\u0430\u0431\u0440\u0435<\/a> \u0438\u043b\u0438 Google.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h4><b>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0442\u0435\u043e\u0440\u0438\u0438 \u0438 \u0441\u0435\u0442\u0435\u0432\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438<\/b><\/h4>\n<p>  \u0414\u043b\u044f \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f <a href=\"https:\/\/ru.wikipedia.org\/wiki\/Wake-on-LAN\">Wake on Lan<\/a>. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0431\u043e\u0442 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u043e\u0431\u043b\u0430\u043a\u0435, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0430\u043a\u0435\u0442 \u043d\u0430 \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0430\u0434\u0440\u0435\u0441. \u0412 \u0441\u0432\u044f\u0437\u0438 \u0441 \u044d\u0442\u0438\u043c, \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0437\u0430\u0431\u043e\u0442\u0438\u0442\u044c\u0441\u044f \u043e \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043f\u0430\u043a\u0435\u0442 \u0432 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u043f\u0430\u043b \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0435\u0442\u044c \u0438 \u0434\u043e\u0441\u0442\u0438\u0433 \u043d\u0443\u0436\u043d\u043e\u0439 \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u043f\u043b\u0430\u0442\u044b. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0431\u0440\u043e\u0441\u0438\u0442\u044c \u043f\u043e\u0440\u0442 \u043d\u0430 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0442\u043e\u0440\u0435:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/337\/d02\/ab3\/337d02ab31924985a8cbcc7085fb3e9c.png\"\/><\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043e\u0447\u0435\u043c\u0443 7 \u043f\u043e\u0440\u0442 \u0438 \u0442\u0430\u043a\u043e\u0439 \u0430\u0434\u0440\u0435\u0441?<\/b><\/p>\n<div class=\"spoiler_text\">\u041e\u0431\u044b\u0447\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Wake on Lan, \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u00ab\u0432\u043e\u043b\u0448\u0435\u0431\u043d\u044b\u0439 \u043f\u0430\u043a\u0435\u0442\u00bb \u043d\u0430 \u0448\u0438\u0440\u043e\u043a\u043e\u0432\u0435\u0449\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438, \u043d\u0430 \u043f\u043e\u0440\u0442 7\/UDP (\u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043c\u043e\u0433\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u043e\u0440\u0442\u044b). \u041a\u043e\u0433\u0434\u0430 \u0441\u0435\u0442\u0435\u0432\u0430\u044f \u043a\u0430\u0440\u0442\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u201c\u0441\u0432\u043e\u0439\u201d \u043f\u0430\u043a\u0435\u0442, \u043e\u043d\u0430 \u043f\u043e\u0434\u0430\u0435\u0442 \u0441\u0438\u0433\u043d\u0430\u043b \u043d\u0430 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430. <\/p>\n<p>  \u041f\u0430\u043a\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043d\u0430\u0431\u043e\u0440\u0430 \u0431\u0430\u0439\u0442 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435: \u043f\u0435\u0440\u0432\u044b\u0435 6 \u0431\u0430\u0439\u0442\u043e\u0432 \u2014 \u043d\u0443\u043b\u0435\u0432\u044b\u0435, \u0437\u0430\u0442\u0435\u043c \u0438\u0434\u0435\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0431\u0430\u0439\u0442 \u0438\u0437 \u043c\u0430\u043a-\u0430\u0434\u0440\u0435\u0441\u0430 \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u043a\u0430\u0440\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442\u0441\u044f 16 \u0440\u0430\u0437. \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u043e MAC \u0430\u0434\u0440\u0435\u0441\u0443 \u0441\u0435\u0442\u0435\u0432\u0430\u044f \u043a\u0430\u0440\u0442\u0430 \u0438 \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u0435\u0435 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440.<\/p>\n<p>  \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u043f\u0430\u043a\u0435\u0442 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0435\u0433\u043e \u043d\u0430 \u043d\u0430\u0448 \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0430\u0434\u0440\u0435\u0441 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430 \u0430\u0434\u0440\u0435\u0441 \u0434\u043e\u043c\u0430\u0448\u043d\u0435\u0433\u043e \u0440\u043e\u0443\u0442\u0435\u0440\u0430), \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043f\u0430\u043a\u0435\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u0443\u0434\u0435\u0442 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 broadcast \u0430\u0434\u0440\u0435\u0441 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438. <\/p>\n<p>  \u0412 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u043e\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f 7 \u043f\u043e\u0440\u0442 (\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439 \u0438\u0437 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430) \u043d\u0430 \u0448\u0438\u0440\u043e\u0432\u0435\u0449\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 \u0441\u0435\u0442\u0438 (10.10.10.255).  <\/div>\n<\/div>\n<h4><b>\u041f\u0438\u0448\u0435\u043c \u043a\u043e\u0434<\/b><\/h4>\n<p>  \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 API \u0431\u043e\u0442\u0430 \u0431\u044b\u043b\u0430 \u0432\u044b\u0431\u0440\u0430\u043d\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 <a href=\"https:\/\/github.com\/MrRoundRobin\/telegram.bot\">Telegram.Bot<\/a>. \u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0439 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/core.telegram.org\/bots\/api#setwebhook\">\u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0441 \u0432\u0435\u0431\u0445\u0443\u043a\u043e\u043c<\/a>. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u0430\u0436\u0434\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0438\u043b\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0431\u043e\u0442, \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u044b \u043d\u0430 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 URL.<\/p>\n<p>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0445\u043e\u0441\u0442\u0438\u043d\u0433\u0430 \u0431\u044b\u043b\u043e \u0440\u0435\u0448\u0435\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Azure, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u043f\u043e \u0432\u0441\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c:  <\/p>\n<ul>\n<li>\u0432\u0441\u0435\u0433\u0434\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d<\/li>\n<li>\u043d\u0430 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e\u043c \u0442\u0430\u0440\u0438\u0444\u0435 \u0435\u0441\u0442\u044c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u0441\u0430\u0439\u0442\u0443 \u043f\u043e HTTPS (\u0431\u043e\u0442\u044b \u043c\u043e\u0433\u0443\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f\u043c)<\/li>\n<li>\u0431\u044b\u0441\u0442\u0440\u0430\u044f \u0438 \u0443\u0434\u043e\u0431\u043d\u0430\u044f \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044f \u0441\u0430\u0439\u0442\u0430 \u043f\u0440\u044f\u043c\u043e \u0438\u0437 Visual Studio<\/li>\n<\/ul>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043d\u0430\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0431\u043e\u0442\u043e\u043c:<\/p>\n<pre><code class=\"cs\">public static class Bot {     private static Api _bot;      \/\/\/ &lt;summary&gt;     \/\/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0431\u043e\u0442\u0430, \u0430 \u0435\u0441\u043b\u0438 \u043e\u043d \u0435\u0449\u0435     \/\/\/ \u043d\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d - \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c     \/\/\/ \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c     \/\/\/ &lt;\/summary&gt;     public static Api Get()     {         if (_bot != null) return _bot;         _bot = new Api(Config.BotApiKey);         _bot.SetWebhook(Config.WebHookUrl);         return _bot;     } } <\/code><\/pre>\n<p>  \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0434\u043e\u0441\u0442\u0430\u0435\u043c \u0438\u0437 \u043a\u043b\u0430\u0441\u0441\u0430 Config  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Config.cs<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">public static class Config {     \/\/\/ &lt;summary&gt;     \/\/\/ \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0434\u043b\u044f \u0431\u043e\u0442\u0430 \u0445\u0440\u0430\u043d\u0438\u043c \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f     \/\/\/ &lt;\/summary&gt;     private static readonly NameValueCollection Appsettings = ConfigurationManager.AppSettings;      \/\/\/ &lt;summary&gt;     \/\/\/ \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0442\u043e\u043a\u0435\u043d \u0434\u043b\u044f \u0431\u043e\u0442\u0430     \/\/\/ &lt;\/summary&gt;     public static string BotApiKey     {         get { return Appsettings[&quot;BotApiKey&quot;]; }     }      \/\/\/ &lt;summary&gt;     \/\/\/ URL, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u044c \u0432\u0441\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u0442 \u0431\u043e\u0442\u0430     \/\/\/ &lt;\/summary&gt;     public static string WebHookUrl     {         get { return Appsettings[&quot;WebHookUrl&quot;]; }     } } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0430\u043a\u0435\u0442. \u0417\u0430 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441 WakeOnLan<\/p>\n<pre><code class=\"cs\">\/\/\/ &lt;summary&gt; \/\/\/ \u041c\u043e\u0436\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c &quot;\u0432\u043e\u043b\u0448\u0435\u0431\u043d\u044b\u0435&quot; \u043f\u0430\u043a\u0435\u0442\u044b \u0434\u043b\u044f \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430 \/\/\/ &lt;\/summary&gt; public static class WakeOnLan {     public static void Up(string ip, string mac, int? port = null)     {         var client = new UdpClient();         var data = new byte[102];          for (var i = 0; i &lt;= 5; i++) \/\/ \u043f\u0435\u0440\u0432\u044b\u0435 \u0448\u0435\u0441\u0442\u044c \u0431\u0430\u0439\u0442 - \u043d\u0443\u043b\u0435\u0432\u044b\u0435             data[i] = 0xff;          var macDigits = GetMacDigits(mac);         if (macDigits.Length != 6)             throw new ArgumentException(&quot;Incorrect MAC address supplied!&quot;);          const int start = 6;         for (var i = 0; i &lt; 16; i++) \/\/ \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u0443\u0436\u043d\u0443\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0431\u0430\u0439\u0442 \u0434\u043b\u044f \u043f\u0430\u043a\u0435\u0442\u0430             for (var x = 0; x &lt; 6; x++)                 data[start + i * 6 + x] = (byte)Convert.ToInt32(macDigits[x], 16);          client.Send(data, data.Length, ip, port ?? 7); \/\/ \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0430\u043a\u0435\u0442     }      private static string[] GetMacDigits(string mac) \/\/ \u043f\u0430\u0440\u0441\u0438\u043c MAC     {         return mac.Split(mac.Contains(&quot;-&quot;) ? '-' : ':');     }      public static bool ValidateMac(string mac) \/\/ \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 \u0432\u0430\u043b\u0438\u0434\u043d\u043e\u0441\u0442\u044c MAC \u0430\u0434\u0440\u0435\u0441\u0430     {         return GetMacDigits(mac).Length == 6;     } } <\/code><\/pre>\n<p>  \u041f\u0430\u043a\u0435\u0442\u044b \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u0438 \u0443\u043c\u0435\u0435\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c. \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0443\u0447\u0438\u0442\u044c \u0431\u043e\u0442\u0430 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u043d\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0443, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \/wol.<br \/>  \u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438, \u0442.\u0435. \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u0443\u0434\u0435\u0442 \u0432\u0432\u0435\u0441\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435<br \/>  <code> \/wol 1.2.3.4 01:02:03:04:05:06 7 <\/code><br \/>  \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043f\u0430\u043a\u0435\u0442 \u043d\u0430 \u0430\u0434\u0440\u0435\u0441 1.2.3.4, \u043d\u0430 7 \u043f\u043e\u0440\u0442 \u0438 \u0440\u0430\u0437\u0431\u0443\u0434\u0438\u0442\u044c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u0441 MAC \u0430\u0434\u0440\u0435\u0441\u043e\u043c 01:02:03:04:05:06<\/p>\n<pre><code class=\"cs\">public async void Handle(Message message) {     var text = message.Text.Split(' ');     if (text.First() != &quot;\/wol&quot;) return;     switch (text.Count())     {         case 1:         case 2:             await _bot.SendTextMessage(message.Chat.Id, &quot;\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f: \/wol 1.2.3.4 01:02:03:04:05:06 7&quot;);             break;         default:             if (!WakeOnLan.ValidateMac(text[2]))                 await _bot.SendTextMessage(message.Chat.Id, &quot;\u041d\u0435\u0432\u0435\u0440\u043d\u044b\u0439 MAC \u0430\u0434\u0440\u0435\u0441&quot;);             else             {                 try                 {                     WakeOnLan.Up(text[1], text[2], GetPort(text));                     await _bot.SendTextMessage(message.Chat.Id, &quot;\u041f\u0430\u043a\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d!&quot;);                 }                 catch (Exception)                 {                     await _bot.SendTextMessage(message.Chat.Id, &quot;\u041f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u0430 \u043e\u0448\u0438\u0431\u043a\u0430 :(&quot;);                 }             }             break;     } }  \/\/\/ &lt;summary&gt; \/\/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u043e\u0440\u0442 \u0438\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \/\/\/ &lt;\/summary&gt; private static int? GetPort(IReadOnlyList&lt;string&gt; text) {     int port;     if (text.Count == 4 && int.TryParse(text[3], out port))         return port;     return null; } <\/code><\/pre>\n<p>  \u041e\u0442\u043b\u0438\u0447\u043d\u043e, \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043b\u0438\u0448\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u0442 \u0431\u043e\u0442\u0430:  <\/p>\n<pre><code class=\"cs\">public class MessageController : ApiController {     [Route(@&quot;api\/message\/wol&quot;)]     public OkResult Post([FromBody]Update value)     {         Task.Run(() =&gt; new Handler().Handle(value.Message));         return Ok();     } } <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u00ab\u0437\u0430\u043b\u0438\u0432\u043a\u0438\u00bb \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 Azure \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0431\u043e\u0442\u0430:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/6e4\/4e1\/bcc\/6e44e1bcc47a4ccd81739500d82e8808.PNG\"\/><\/p>\n<p>  <b>\u0421\u0441\u044b\u043b\u043a\u0438: <\/b><br \/>  <a href=\"https:\/\/github.com\/spoofi\/WolBot\">\u041f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430 GitHub<\/a><br \/>  <a href=\"https:\/\/core.telegram.org\/bots\/api\">API \u0431\u043e\u0442\u043e\u0432 Telegram<\/a><br \/>  <a href=\"https:\/\/github.com\/MrRoundRobin\/telegram.bot\">\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 Telegram.Bot (GitHub)<\/a>             <\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/265305\/\"> http:\/\/habrahabr.ru\/post\/265305\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>             \u041f\u043e\u0441\u043b\u0435 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f <a href=\"https:\/\/core.telegram.org\/bots\/api\">API \u0431\u043e\u0442\u043e\u0432<\/a> \u0434\u043b\u044f Telegram \u0438\u0445 \u043f\u043e\u043f\u0443\u043b\u044f\u0446\u0438\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u0442\u0440\u0435\u043c\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u0442\u0438. \u042f \u0440\u0435\u0448\u0438\u043b \u043d\u0435 \u043e\u0442\u0441\u0442\u0430\u0432\u0430\u0442\u044c \u0438 \u043e\u0431\u0437\u0430\u0432\u0435\u0441\u0442\u0438\u0441\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u0434\u043b\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440. \u0414\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0431\u044b\u043b \u0432\u044b\u0431\u0440\u0430\u043d \u044f\u0437\u044b\u043a C#, \u0430 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0445\u043e\u0441\u0442\u0438\u043d\u0433\u0430 \u0432\u044b\u0431\u043e\u0440 \u043f\u0430\u043b \u043d\u0430 Azure.<\/p>\n<h4><b>\u0417\u0430\u0434\u0430\u0447\u0430<\/b><\/h4>\n<p> \u041d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0431\u043e\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u00ab\u043c\u0430\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u0430\u043a\u0435\u0442\u044b\u00bb \u0434\u043b\u044f \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430 \u043d\u0430 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 \u0438 \u043f\u043e\u0440\u0442.<\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u043d\u0435 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0442\u043e\u043a\u0435\u043d\u0430 \u0434\u043b\u044f \u0431\u043e\u0442\u0430 \u0438 \u0434\u0435\u043f\u043b\u043e\u0439 \u0441\u0430\u0439\u0442\u0430 \u043d\u0430 Azure. \u041d\u0430 \u044d\u0442\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0431\u0435\u0437 \u0442\u0440\u0443\u0434\u0430 <a href=\"http:\/\/habrahabr.ru\/post\/262247\/\">\u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u0445\u0430\u0431\u0440\u0435<\/a> \u0438\u043b\u0438 Google.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-264135","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/264135","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=264135"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/264135\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=264135"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=264135"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=264135"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}