{"id":396827,"date":"2024-06-29T13:04:33","date_gmt":"2024-06-29T13:04:33","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=396827"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2024-06-29T13:04:33","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=396827","title":{"rendered":"<span>\u0427\u0430\u0442-\u0431\u043e\u0442 \u0434\u043b\u044f mattermost<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442! \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0435\u043c, \u043a\u0430\u043a \u043c\u044b \u0432 <a href=\"http:\/\/hh.ru\">hh.ru<\/a> \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0443\u0434\u043e\u0431\u043d\u043e\u0435 \u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0441 \u043a\u043e\u0440\u043f\u043e\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 wiki \u0432 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u043a\u043e\u043c\u043c\u0443\u043d\u0438\u043a\u0430\u0446\u0438\u0438 \u2014 \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0447\u0430\u0442-\u0431\u043e\u0442\u0430 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0439 \u0431\u0430\u0437\u0435 \u0437\u043d\u0430\u043d\u0438\u0439. \u0414\u043b\u044f \u043d\u0430\u0441 \u0442\u0435\u043c\u0430 \u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439, \u043c\u043e\u0436\u0435\u0442 \u0438 \u0432\u0430\u043c \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/bfd\/ba5\/148\/bfdba5148a15038b7d360c83d320a597.jpg\" width=\"1920\" height=\"1080\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/bfd\/ba5\/148\/bfdba5148a15038b7d360c83d320a597.jpg\" data-blurred=\"true\"\/><\/figure>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e \u043a\u043e\u043c\u043c\u0443\u043d\u0438\u043a\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u043e\u0432\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434 \u0443 \u043d\u0430\u0441 \u2014 <a href=\"https:\/\/mattermost.com\/\"><u>mattermost<\/u><\/a>. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0431\u0430\u0437\u044b \u0437\u043d\u0430\u043d\u0438\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <a href=\"https:\/\/www.atlassian.com\/software\/confluence\"><u>Confluence<\/u><\/a>. \u041d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u0439 \u043f\u043e\u0438\u0441\u043a Confluence \u0438\u043c\u0435\u0435\u0442 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u0430 \u043d\u0430\u043c \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0438 \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430. \u0414\u043b\u044f \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u0438 \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0432 \u043d\u0430\u0448\u0435\u0439 \u043e\u0431\u0448\u0438\u0440\u043d\u043e\u0439 \u0431\u0430\u0437\u0435 \u0437\u043d\u0430\u043d\u0438\u0439 \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0447\u0430\u0442-\u0431\u043e\u0442\u0430 \u0432 mattermost. \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u0431\u043e\u0442\u0430 \u0441\u0442\u0430\u043b \u0432\u044b\u0432\u043e\u0434 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u043f\u043e\u0438\u0441\u043a\u0430 \u0432 \u043b\u0438\u0447\u043d\u044b\u0439 \u0447\u0430\u0442 \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c. \u0411\u043e\u0442\u0430 \u043f\u0438\u0441\u0430\u043b\u0438 \u043d\u0430 Python: \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0431\u0430\u0437\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a mmpy_bot, \u0430 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 confluence \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f confluenceAPI.\u00a0\u00a0<\/p>\n<h2>\u041a\u043e\u0440\u043e\u0442\u043a\u043e \u043e mmpy_bot \u0438 confluenceAPI<\/h2>\n<p>\u0424\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a mmpy_bot \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0432\u044b\u0437\u043e\u0432\u0430\u043c\u0438 API mattermost \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440\u043e\u0432 \u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0445 \u043b\u043e\u0433\u0438\u043a\u0443 \u0431\u043e\u0442\u0430 \u2014 \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u0432. \u0422\u0430\u043a\u0436\u0435 \u0431\u043e\u0442 \u0438\u043c\u0435\u0435\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0432\u0435\u0431\u0445\u0443\u043a-\u0441\u0435\u0440\u0432\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043e\u043c. \u0421 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f <a href=\"https:\/\/mmpy-bot.readthedocs.io\/en\/latest\/\"><u>\u0437\u0434\u0435\u0441\u044c<\/u><\/a>.\u00a0<\/p>\n<p>\u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440\u044b \u2014 <a class=\"mention\" href=\"\/users\/listen_to\">@listen_to<\/a>, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0439 \u0437\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u0438 <a class=\"mention\" href=\"\/users\/listen_webhook\">@listen_webhook<\/a>, \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0439 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0432\u0435\u0431\u0445\u0443\u043a\u0430\u043c\u0438. \u0414\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0443 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 \u0431\u043e\u0442\u0430 \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430: create_post(), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043d\u043e\u0432\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432 \u043a\u0430\u043d\u0430\u043b\u0435, \u0438 reply_to(), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0443 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0432 \u0442\u0440\u0435\u0434 \u043a \u0438\u043c\u0435\u044e\u0449\u0435\u043c\u0443\u0441\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044e. \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c reply_to().<\/p>\n<p>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 confluence \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/atlassian-python-api.readthedocs.io\/confluence.html\"><u>\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a<\/u><\/a>, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u0438\u043d \u043c\u0435\u0442\u043e\u0434 Confluence.cql(), \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0439 \u0437\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0443 \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 CQL \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 confluence.\u00a0<\/p>\n<h2>\u0417\u0430\u043f\u0443\u0441\u043a \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0431\u043e\u0442\u0430<\/h2>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c \u043a\u0430\u043a \u043d\u0430\u0447\u0430\u0442\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u0431\u043e\u0442\u0430, \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u043e\u043a\u0435\u043d\u044b \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u0432 mattermost \u0438 confluence. \u041f\u043e\u0441\u043b\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0442\u043e\u043a\u0435\u043d\u043e\u0432 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c 2 \u0444\u0430\u0439\u043b\u0430 \u2014 <a href=\"http:\/\/mm-bot.py\">mm-bot.py<\/a>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0431\u043e\u0442 \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043d\u0430\u0448 \u043f\u043b\u0430\u0433\u0438\u043d, \u0438 <a href=\"http:\/\/plugin.py\">plugin.py<\/a>, \u0433\u0434\u0435 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432\u0441\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u0440\u0430\u0431\u043e\u0442\u044b \u0431\u043e\u0442\u0430.<\/p>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u2014 \u0441 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0431\u043e\u0442\u0430:<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">import json import sys  from mmpy_bot import Bot, Settings from plugin import SearchPlugin  try: \u00a0\u00a0\u00a0 with open('config.json', 'r', encoding='utf-8') as config: \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0settings = json.loads(config.read())['wiki-search-bot'] except IOError as e: \u00a0\u00a0\u00a0\u00a0print(f'Unable to read config! Reason: {e}') \u00a0\u00a0\u00a0\u00a0sys.exit(1)  bot = Bot( \u00a0\u00a0\u00a0\u00a0settings=Settings( \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0MATTERMOST_URL=settings['mattermost_host'], \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0MATTERMOST_PORT=settings['mattermost_port'], \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0MATTERMOST_API_PATH='\/api\/v4', \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0BOT_TOKEN=settings['mattermost_token'], \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0BOT_TEAM=settings['team_name'], \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0SSL_VERIFY=False, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0WEBHOOK_HOST_ENABLED=True, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0WEBHOOK_HOST_URL=settings['webhook_host'], \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0WEBHOOK_HOST_PORT=settings['webhook_self_port'], \u00a0\u00a0\u00a0\u00a0), \u00a0\u00a0\u00a0\u00a0plugins=[SearchPlugin()], ) bot.run()<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0447\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442. \u0412 \u0441\u0430\u043c\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0435 \u043c\u044b \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u0431\u043e\u0442\u0430 \u0438\u0437 json \u0441 \u043a\u043e\u043d\u0444\u0438\u0433\u0430\u043c\u0438. \u0421\u0430\u043c \u043a\u043e\u043d\u0444\u0438\u0433 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">{ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"mattermost_host\": \"https:\/\/\u0430\u0434\u0440\u0435\u0441.\u0441\u0435\u0440\u0432\u0435\u0440\u0430.\u043c\u0430\u0442\u0442\u0435\u0440\u043c\u043e\u0441\u0442\", \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"mattermost_port\": \"\u043f\u043e\u0440\u0442.\u0441\u0435\u0440\u0432\u0435\u0440\u0430.\u043c\u0430\u0442\u0442\u0435\u0440\u043c\u043e\u0441\u0442\", \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"mattermost_token\": \"\u0442\u043e\u043a\u0435\u043d_\u0431\u043e\u0442\u0430_mattermost\", \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"team_name\": \"\u0438\u043c\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b\", \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"webhook_host\": \"http:\/\/\u0430\u0434\u0440\u0435\u0441.\u0445\u043e\u0441\u0442\u0430\", \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"webhook_self_port\": \"8579\", \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"webhook_external_port\": \"8579\", \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"confluence_url\": \"https:\/\/\u0430\u0434\u0440\u0435\u0441.\u0431\u0430\u0437\u044b.\u0437\u043d\u0430\u043d\u0438\u0439\", \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"confluence_token\": \"\u0442\u043e\u043a\u0435\u043d_\u0431\u043e\u0442\u0430_confluence\" }  <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u043d\u0430\u0448\u0435\u0433\u043e \u0431\u043e\u0442\u0430 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438. \u0418\u0437 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0437\u0430 \u0447\u0442\u043e \u043e\u043d\u0438 \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0442 \u0438 \u0434\u043b\u044f \u0447\u0435\u0433\u043e \u043d\u0443\u0436\u043d\u044b. \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u0431\u043b\u043e\u043a \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 WEBHOOK_% \u2014 \u043e\u043d\u0438 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u0435\u0431\u0445\u0443\u043a-\u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u041d\u043e \u043e\u0431 \u044d\u0442\u043e\u043c \u043f\u043e\u0437\u0436\u0435. \u041f\u043e\u0441\u043b\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0437\u0430\u043f\u0443\u0441\u043a \u0431\u043e\u0442\u0430 \u0447\u0435\u0440\u0435\u0437 \u0432\u044b\u0437\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u0430 run(). \u0421\u0430\u043c \u0431\u043e\u0442 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 <em>python mm_bot.py<\/em>.<\/p>\n<h2>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0440\u0430\u0431\u043e\u0442\u044b \u0431\u043e\u0442\u0430<\/h2>\n<p>\u0418\u0442\u0430\u043a, \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0432\u044b\u0431\u0440\u0430\u043d\u044b, \u0431\u043e\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d \u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0443. \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0434\u043e \u043f\u0440\u043e\u0434\u0443\u043c\u0430\u0442\u044c \u043b\u043e\u0433\u0438\u043a\u0443 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u0431\u043e\u0442\u043e\u043c \u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u044b.<\/p>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e. \u041e\u0431\u0449\u0430\u0442\u044c\u0441\u044f \u0441 \u0431\u043e\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0435\u0440\u0435\u0437 \u043b\u0438\u0447\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u2014 \u043f\u0443\u0442\u0435\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0441 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u043b\u0430\u0433\u0438\u043d\u0435 \u0434\u043b\u044f \u0431\u043e\u0442\u0430 \u2014 \u0444\u0430\u0439\u043b\u0435 <a href=\"http:\/\/plugin.py\">plugin.py<\/a>. \u041e\u0434\u043d\u0430\u043a\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0438 \u043d\u0435 \u0437\u043d\u0430\u0442\u044c \u043e \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0441\u043b\u043e\u0432, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043b\u044e\u0431\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0441\u043b\u043e\u0432\u0430. \u0422\u0430\u043a\u043e\u0439 \u043c\u0435\u0442\u043e\u0434-\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u0443\u044e \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0443 \u043f\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e \u0431\u043e\u0442\u0430.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/861\/ce0\/147\/861ce01470ed54d130aab2451108a036.png\" alt=\"\" title=\"\" width=\"661\" height=\"310\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/861\/ce0\/147\/861ce01470ed54d130aab2451108a036.png\"\/><\/figure>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u0448\u0438\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u043c \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 <a class=\"mention\" href=\"\/users\/listen_to\">@listen_to<\/a>(). \u041e\u043d \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0431\u043e\u0442\u0443 \u201c\u0441\u043b\u0443\u0448\u0430\u0442\u044c\u201d \u043a\u0430\u043d\u0430\u043b\u044b, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043d \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d, \u043d\u0430 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440\u0430. \u0412 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u2014 \u044d\u0442\u043e \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0449\u0435\u0435 \u043b\u044e\u0431\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043a\u0440\u043e\u043c\u0435 \u201c\u041d\u0430\u0439\u0434\u0438\u201d. \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440\u0430 \u043c\u043e\u0436\u0435\u0442 \u0432\u0430\u0440\u044c\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 capture group \u0432 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043a\u0435.\u00a0<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">@listen_to(\"^((?!\u041d\u0430\u0439\u0434\u0438).)*$\", re.IGNORECASE) async def hello(self, message: Message, status):         blocks = [             Section(                 title=f'\u041f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e!',                 text=f'\u042f \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u044e \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u0431\u0430\u0437\u0435 \u0437\u043d\u0430\u043d\u0438\u0439 [wiki]({confluence_url}). \u041f\u043e\u0438\u0441\u043a \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u043c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\u043c.\\n\u0427\u0442\u043e\u0431\u044b \u043d\u0430\u0447\u0430\u0442\u044c \u043f\u043e\u0438\u0441\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0441\u043b\u043e\u0432\u043e **\u041d\u0430\u0439\u0434\u0438** \u0438 \u0432\u0430\u0448 \u0437\u0430\u043f\u0440\u043e\u0441, \u043f\u0440\u0438\u043c\u0435\u0440: **\u041d\u0430\u0439\u0434\u0438 \u0446\u0435\u043b\u0438 \u0438 \u043f\u043b\u0430\u043d\u044b**',                 ])))         ]         mes_json = {'attachments': [block.asdict() for block in blocks]}         self.driver.reply_to(message, '', props=mes_json) <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p><em>\u0422\u0443\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b \u043f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u044f. \u0412 \u0441\u0430\u043c\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0447\u0442\u043e-\u0442\u043e \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e\u0435. \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0442\u0430\u043a \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0442\u0441\u044f <\/em><a href=\"https:\/\/developers.mattermost.com\/integrate\/plugins\/interactive-messages\/\"><em><u>\u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f<\/u><\/em><\/a><em>. \u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u0430\u043a\u0438\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0431\u044b\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u044b \u0434\u0430\u0442\u0430\u043a\u043b\u0430\u0441\u0441\u044b:<\/em><\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">@dataclass class Field: \u00a0\u00a0\u00a0\u00a0title: str \u00a0\u00a0\u00a0\u00a0value: str \u00a0\u00a0\u00a0\u00a0short: bool = True  @dataclass class Section: \u00a0\u00a0\u00a0\u00a0title: Optional[str] = None \u00a0\u00a0\u00a0\u00a0text: Optional[str] = None \u00a0\u00a0\u00a0\u00a0fields: Optional[List[Field]] = None  \u00a0\u00a0\u00a0\u00a0def asdict(self): \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0res = {} \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if self.fields: \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0res['fields'] = [asdict(field) for field in self.fields] \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if self.title: \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0res['title'] = str(self.title) \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if self.text: \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0res['text'] = str(self.text)  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return res<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c \u0432 \u0431\u043e\u0442\u0435 \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e:<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">@listen_to(\"^((?!\u041d\u0430\u0439\u0434\u0438).)*$\", re.IGNORECASE) async def hello(self, message: Message, status):         blocks = [             Section(                 title=f'\u041f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e!',                 text=f'\u042f \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u044e \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u0431\u0430\u0437\u0435 \u0437\u043d\u0430\u043d\u0438\u0439 [wiki]({confluence_url}). \u041f\u043e\u0438\u0441\u043a \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u043c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\u043c.\\n\u0427\u0442\u043e\u0431\u044b \u043d\u0430\u0447\u0430\u0442\u044c \u043f\u043e\u0438\u0441\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0441\u043b\u043e\u0432\u043e **\u041d\u0430\u0439\u0434\u0438** \u0438 \u0432\u0430\u0448 \u0437\u0430\u043f\u0440\u043e\u0441, \u043f\u0440\u0438\u043c\u0435\u0440: **\u041d\u0430\u0439\u0434\u0438 \u0446\u0435\u043b\u0438 \u0438 \u043f\u043b\u0430\u043d\u044b**',                 fields=list(filter(None, [                     Field(title='\u041f\u043e\u0438\u0441\u043a \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u043f\u0440\u0435\u0434\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438:', value='', short=False),                     Field(title='\u041f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430', value='QA, DEV'),                     Field(title='\u041f\u0435\u0440\u0438\u043e\u0434', value='\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0433\u043e\u0434'),                     Field(title='\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435', value='\u0421\u0442\u0440\u0430\u043d\u0438\u0446\u0430'),                 )         ]         mes_json = {'attachments': [block.asdict() for block in blocks]}         self.driver.reply_to(message, '', props=mes_json)<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043c\u044b \u043f\u0440\u043e\u0438\u043d\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043b\u0438. \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0434\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0438\u0441\u043a \u0432 \u0431\u0430\u0437\u0435 \u0437\u043d\u0430\u043d\u0438\u0439. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 \u201c\u041d\u0430\u0439\u0434\u0438\u201d:<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">    @listen_to(\"\u041d\u0430\u0439\u0434\u0438 (.*)\", re.IGNORECASE)     async def search(self, message: Message, text_to_search):         search_result = []         log.info(f'\u0417\u0430\u043f\u0440\u043e\u0448\u0435\u043d \u043f\u043e\u0438\u0441\u043a \"{text_to_search}\"')         search = Search(search_text=text_to_search)         query = SearchQuery(search_text=text_to_search)          label_response = search_by_label(text_to_search)         find_response = self.query(query)          if label_response != '':             label_search_result = label_response             for res in find_response['results']:                 for label_res in label_search_result['results']:                     if label_res['content']['id'] == res['content']['id']:                         search_result.append(res)              for res in find_response['results']:                 flag = False                 for label_res in label_search_result['results']:                     if label_res['content']['id'] == res['content']['id']:                         flag = True                 if not flag:                     search_result.append(res)         else:             search_result = find_response['results']          search.search_results = search_result         self.print_search_result(message, search)<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0412 \u043c\u0435\u0442\u043e\u0434\u0435 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u044b\u0437\u043e\u0432 \u0434\u0432\u0443\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 search_by_label() \u0438 self.query():<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">def search_by_label(label_text):     confluence = Confluence(url=confluence_url, token=confluence_token)     cql = f'type=\"page\" AND label=\"{label_text}\"'     try:         response = confluence.cql(cql, start=0, limit=100, expand=None, include_archived_spaces=None, excerpt=None)         return response     except Exception as e:         log.error(f'Unable to parse cql query. Reason: {e} cql: {cql}')     return ''<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041e\u0431\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0442 \u0437\u0430 \u043f\u043e\u0438\u0441\u043a \u0432 \u0431\u0430\u0437\u0435 \u0437\u043d\u0430\u043d\u0438\u0439, \u043d\u043e search_by_label() \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u043e\u0441\u043e\u0431\u044b\u0439 cql-\u0437\u0430\u043f\u0440\u043e\u0441, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0439 \u0437\u0430 \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u043c\u0435\u0442\u043a\u0430\u043c\/\u043b\u0435\u0439\u0431\u043b\u0430\u043c (labels) \u0441\u0442\u0430\u0442\u0435\u0439, \u0442\u043e \u0435\u0441\u0442\u044c \u043d\u0443\u0436\u043d\u0430\u044f \u0444\u0440\u0430\u0437\u0430 \u0438\u0449\u0435\u0442\u0441\u044f \u0441\u0440\u0435\u0434\u0438 \u043c\u0435\u0442\u043e\u043a. \u0422\u0430\u043a\u043e\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043e\u0431\u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043e \u0436\u0435\u043b\u0430\u043d\u0438\u0435\u043c \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u044b\u0434\u0430\u0447\u0443 \u0441\u0442\u0430\u0442\u0435\u0439 \u0441 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u043c\u0438 \u043c\u0435\u0442\u043a\u0430\u043c\u0438 \u0432 \u043e\u0442\u0432\u0435\u0442\u0435 \u0431\u043e\u0442\u0430. \u0412 \u043c\u0435\u0442\u043e\u0434\u0435 query() \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 cql-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u043d\u0430\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0438 \u0432\u044b\u0437\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u0430 advanced_search_on_wiki() \u0434\u043b\u044f \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0438\u0441\u043a\u0430.<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">def query(self, query: SearchQuery):         period_postfix = ''         space_list = []         content_list = []         content_postfix = ''         space_postfix = ''         label_postfix = ''         title_postfix = ''          period_postfix = f' and lastmodified > {query.modify_period}'         if query.HHQA:             space_list.append('\"HHQA\"')         if query.HHDEV:             space_list.append('\"HHDEV\"')         space_postfix = f' and space in ({\",\".join(space_list)})'          if query.page:             content_list.append('\"page\"')         if query.blogpost:             content_list.append('\"blogpost\"')         if query.comment:             content_list.append('\"comment\"')         if query.attachment:             content_list.append('\"attachment\"')         content_postfix = f' and type in ({\",\".join(content_list)})'          if query.label_text != '' and query.label_text is not None:             label_postfix = f' and label = \"{query.label_text}\"'         if query.title_text != '' and query.title_text is not None:             label_postfix = f' and title ~ \"{query.title_text}\"'          query.search_request = f'\"{query.search_text}\"{space_postfix}{content_postfix}{period_postfix}{label_postfix}{title_postfix}'         response = advanced_search_on_wiki(query.search_request)          return response<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h2>\u0418\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432 \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c<\/h2>\n<p>\u0418\u0442\u0430\u043a, \u043d\u0430\u0448 \u0431\u043e\u0442 \u0442\u0435\u043f\u0435\u0440\u044c \u0443\u043c\u0435\u0435\u0442 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043d\u043e \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b. \u041d\u043e \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u0439\u0442\u0438 \u0434\u0430\u043b\u044c\u0448\u0435 \u0438 \u043d\u0430\u043b\u0430\u0434\u0438\u0442\u044c \u201c\u0434\u0438\u0430\u043b\u043e\u0433\u201d \u0441 \u043d\u0438\u043c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 mattermost \u0432 \u043d\u0430\u0448 \u0447\u0430\u0442-\u0431\u043e\u0442.\u00a0<\/p>\n<p>\u0412\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u0432\u0441\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u043e\u0438\u0441\u043a\u0430 \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u043e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0431\u0443\u0434\u0435\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u044f\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441 \u043e \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0438 \u0432\u044b\u0432\u043e\u0434\u0430 \u0438\u043b\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/e82\/4cb\/b87\/e824cbb87430d93556063d9f734dd44d.jpeg\" alt=\"\" title=\"\" width=\"1500\" height=\"1080\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e82\/4cb\/b87\/e824cbb87430d93556063d9f734dd44d.jpeg\" data-blurred=\"true\"\/><\/figure>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u043c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0442\u044c \u043d\u0430\u043c \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0435\u0441\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438\u043b\u0438 \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432\u043e\u043c \u043e\u043a\u043d\u0435:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/802\/e8f\/4e3\/802e8f4e39362c7a5df35aaeae3958ce.png\" alt=\"\" title=\"\" width=\"496\" height=\"106\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/802\/e8f\/4e3\/802e8f4e39362c7a5df35aaeae3958ce.png\"\/><\/figure>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\"> def print_search_result(self, message: Message, search: Search):         total_count = len(search.search_results)          if total_count > 0:             blocks = [                 Section(                     text=f'\u0412\u043e\u0442 **\u0422\u041e\u041f-{max(total_count, 5)}** \u0442\u043e\u0433\u043e \u0447\u0442\u043e \u044f \u043d\u0430\u0448\u0435\u043b \u044f \u043d\u0430\u0448\u0451\u043b \u043f\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0443 \"***{search.search_text}***\":'                 )             ]             message_json = {'attachments': [block.asdict() for block in blocks]}             self.driver.reply_to(message, '', props=message_json)              for result in search.search_results[0:5]:                 title = result['title'].replace(\"@@@hl@@@\", \"**\").replace(\"@@@endhl@@@\", \"**\")                 url = result['url']                 excerpt = result['excerpt'].replace(\"@@@hl@@@\", \"**\").replace(\"@@@endhl@@@\", \"**\")                 blocks = [                     Section(title=f'[{title}]({confluence_url + url})',                             text=f'{excerpt}'                             )                 ]                 mes_json = {'attachments': [block.asdict() for block in blocks]}                 self.driver.reply_to(message, '', props=mes_json)              if total_count > 5:                 self.driver.reply_to(                     message,                     \"\",                     props={                         \"attachments\": [                             {                                 \"pretext\": None,                                 \"text\": f\"\u0412\u0441\u0435\u0433\u043e \u043d\u0430\u0439\u0434\u0435\u043d\u043e **{total_count}** \u0437\u0430\u043f\u0438\u0441\u0435\u0439. \u0412\u044b\u0432\u0435\u0441\u0442\u0438 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 {total_count - 5} \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u043e\u0438\u0441\u043a\u0430?\",                                 \"actions\": [                                     {                                         \"id\": \"yes\",                                         \"name\": \"\u0414\u0430\",                                         \"integration\": {                                             \"url\": f\"{webhook_host}:{webhook_external_port}\/hooks\/yes\",                                             \"context\": dict(channel_id=message.channel_id,                                                             reply_id=message.reply_id,                                                             search_response=search.search_results)                                         },                                     },                                     {                                         \"id\": \"advanced\",                                         \"name\": \"\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u0439 \u043f\u043e\u0438\u0441\u043a\",                                         \"integration\": {                                             \"url\": f\"{webhook_host}:{webhook_external_port}\"                                                    \"\/hooks\/advanced\",                                             \"context\": dict(channel_id=message.channel_id,                                                             reply_id=message.reply_id,                                                             search_text=search.search_text)                                         },                                     },                                 ],                             }                         ]                     },                 )             else:                 blocks = [                     Section(                         text=f'\u0412\u0441\u0435\u0433\u043e \u043d\u0430\u0439\u0434\u0435\u043d\u043e **{total_count}** \u0437\u0430\u043f\u0438\u0441\u0435\u0439.'                     )                 ]                 message_json = {'attachments': [block.asdict() for block in blocks]}                 self.driver.reply_to(message, '', props=message_json)          else:             blocks = [                 Section(                     text=f'\u041f\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0443 \"***{search.search_text}***\" \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043e.'                 )             ]             message_json = {'attachments': [block.asdict() for block in blocks]}             self.driver.reply_to(message, '', props=message_json) <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u0430 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u043e\u043c <a href=\"https:\/\/developers.mattermost.com\/integrate\/plugins\/interactive-dialogs\/\"><u>\u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432<\/u><\/a> \u0441\u0430\u043c\u043e\u0433\u043e mattermost. \u0415\u0433\u043e \u0441\u0443\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0430 \u2014 \u043a\u0430\u043a \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u043c\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u043c\u0438, \u043c\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c post-\u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 {mattermost_host}:{mattermost_port}\/api\/v4\/actions\/dialogs\/open, \u0432 \u0442\u0435\u043b\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0438\u0434\u0435\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 json. \u041d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u044d\u0442\u043e\u0433\u043e json mattermost \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432\u043e\u0435 \u043e\u043a\u043d\u043e \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438. \u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u0435\u0439 \u0434\u0438\u0430\u043b\u043e\u0433\u0430 \u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0441\u0435\u0440\u0432\u0435\u0440 mattermost \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u043d\u0430\u0448 \u0432\u0435\u0431\u0445\u0443\u043a.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/4aa\/478\/5a6\/4aa4785a650e061ad6e370f683c6b1a3.jpeg\" alt=\"\" title=\"\" width=\"1500\" height=\"1080\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/4aa\/478\/5a6\/4aa4785a650e061ad6e370f683c6b1a3.jpeg\" data-blurred=\"true\"\/><\/figure>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">    @listen_webhook(\"advanced\")     async def advanced_search_form(self, event: WebHookEvent):         msg_body = dict(data=dict(             post=dict(channel_id=event.body['context']['channel_id'], root_id=event.body['context']['reply_id'])))         search_text = event.body['context']['search_text']         msg = Message(msg_body)         if isinstance(event, ActionEvent):             payload = {                 \"trigger_id\": event.body['trigger_id'],                 \"url\": f\"{webhook_host}:{webhook_external_port}\/hooks\/adv_search\",                 \"dialog\": {                     \"callback_id\": f'{msg_body}',                     \"title\": \"\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u0439 \u043f\u043e\u0438\u0441\u043a\",                     \"elements\": [                         {                             \"display_name\": \"\u0421\u0442\u0440\u043e\u043a\u0430 \u043f\u043e\u0438\u0441\u043a\u0430\",                             \"placeholder\": \"\u0418\u0441\u043a\u0430\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u0443\u044e \u0444\u0440\u0430\u0437\u0443\",                             \"default\": f'{search_text}',                             \"name\": \"search_text\",                             \"type\": \"text\",                             \"optional\": False                         },                         {                             \"display_name\": \"\u041f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430:\",                             \"name\": \"QA\",                             \"placeholder\": \"QA\",                             \"type\": \"bool\",                             \"optional\": True,                             \"default\": \"True\"                         },                         {                             \"display_name\": \"\",                             \"name\": \"DEV\",                             \"placeholder\": \"DEV\",                             \"type\": \"bool\",                             \"optional\": True,                             \"default\": \"True\"                         },                         {                             \"display_name\": \"\u0414\u0430\u0442\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439\",                             \"name\": \"modify_period\",                             \"type\": \"radio\",                             \"optional\": False,                             \"options\": [                                 {                                     \"text\": \"\u0414\u0435\u043d\u044c\",                                     \"value\": \"now(\\\"-1d\\\")\"                                 },                                 {                                     \"text\": \"\u041d\u0435\u0434\u0435\u043b\u044f\",                                     \"value\": \"now(\\\"-1w\\\")\"                                 },                                 {                                     \"text\": \"\u041c\u0435\u0441\u044f\u0446\",                                     \"value\": \"now(\\\"-1M\\\")\"                                 },                                 {                                     \"text\": \"\u0413\u043e\u0434\",                                     \"value\": \"now(\\\"-1y\\\")\"                                 }                             ],                             \"default\": \"now(\\\"-1y\\\")\"                         },                         {                             \"display_name\": \"\u0418\u0441\u043a\u0430\u0442\u044c \u0432 \u043c\u0435\u0442\u043a\u0430\u0445?\",                             \"placeholder\": \"\u041f\u043e\u0438\u0441\u043a \u043f\u043e \u043c\u0435\u0442\u043a\u0430\u043c\",                             \"name\": \"label_text\",                             \"help_text\": \"\u041f\u043e\u0438\u0441\u043a \u0431\u0443\u0434\u0435\u0442 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0441\u0442\u0430\u0442\u044c\u044f\u0445 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u043c\u0435\u0442\u043a\u043e\u0439\",                             \"type\": \"text\",                             \"optional\": True                         },                         {                             \"display_name\": \"\u0418\u0441\u043a\u0430\u0442\u044c \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430\u0445?\",                             \"placeholder\": \"\u041f\u043e\u0438\u0441\u043a \u043f\u043e \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430\u043c\",                             \"name\": \"title_text\",                             \"help_text\": \"\u041f\u043e\u0438\u0441\u043a \u0431\u0443\u0434\u0435\u0442 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0441\u0442\u0430\u0442\u044c\u044f\u0445 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u043c\",                             \"type\": \"text\",                             \"optional\": True                         },                         {                             \"display_name\": \"\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435:\",                             \"name\": \"page\",                             \"placeholder\": \"\u0421\u0442\u0440\u0430\u043d\u0438\u0446\u0430\",                             \"type\": \"bool\",                             \"optional\": False,                             \"default\": \"true\"                         },                         {                             \"display_name\": \"\",                             \"name\": \"blogpost\",                             \"placeholder\": \"\u0411\u043b\u043e\u0433\",                             \"type\": \"bool\",                             \"optional\": True,                             \"default\": \"false\"                         },                         {                             \"display_name\": \"\",                             \"name\": \"comment\",                             \"placeholder\": \"\u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439\",                             \"type\": \"bool\",                             \"optional\": True,                             \"default\": \"false\"                         },                         {                             \"display_name\": \"\",                             \"name\": \"attachment\",                             \"placeholder\": \"\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\",                             \"type\": \"bool\",                             \"optional\": True,                             \"default\": \"false\"                         },                     ],                     \"submit_label\": \"\u0418\u0441\u043a\u0430\u0442\u044c\",                     \"state\": \"somestate\"                 }             }             requests.post(f\"{mattermost_host}:{mattermost_port}\/api\/v4\/actions\/dialogs\/open\",                           json=payload)          else:             self.driver.reply_to(msg, \"\u0427\u0442\u043e-\u0442\u043e \u043f\u043e\u0448\u043b\u043e \u043d\u0435 \u0442\u0430\u043a\") <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h2>Webhook-\u0441\u0435\u0440\u0432\u0435\u0440<\/h2>\n<p>\u0411\u043e\u0442 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0432\u0435\u0431\u0445\u0443\u043a-\u0441\u0435\u0440\u0432\u0435\u0440. \u041e\u043d \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u043c\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u043c\u0438 \u0438 \u0434\u0438\u0430\u043b\u043e\u0433\u0430\u043c\u0438 mattermost. \u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0432\u0435\u0431\u0445\u0443\u043a\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 <a class=\"mention\" href=\"\/users\/listen_webhook\">@listen_webhook<\/a>(&#171;&#187;), \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u0445 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 \u0445\u0443\u043a\u0430:<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">    @listen_webhook(\"adv_search\")     async def form_listener(self, event: WebHookEvent):         search_query = SearchQuery(**event.body['submission'])         msg_body = event.body['callback_id']         msg = Message(json.loads(msg_body.replace(\"'\", \"\\\"\")))         log.info(f'\u0417\u0430\u043f\u0440\u043e\u0448\u0435\u043d \u043f\u043e\u0438\u0441\u043a (\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u0439) \"{search_query.search_text}\"')         search_result = Search(search_text=search_query.search_text, search_results=self.query(search_query)['results'])         self.print_search_result(msg, search_result) <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0412\u044b\u0448\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043a\u043e\u0434 \u0432\u0435\u0431\u0445\u0443\u043a\u0430, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0435\u0433\u043e \u0437\u0430 \u201c\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u0439 \u043f\u043e\u0438\u0441\u043a\u201d \u0432 \u043d\u0430\u0448\u0435\u0439 \u0431\u0430\u0437\u0435 \u0437\u043d\u0430\u043d\u0438\u0439. \u041a\u043d\u043e\u043f\u043a\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0432 \u0434\u0438\u0430\u043b\u043e\u0433\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u044d\u0442\u043e\u0442 \u0445\u0443\u043a. \u042d\u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 \u043c\u044b \u0443\u0436\u0435 \u0443\u043a\u0430\u0437\u0430\u043b\u0438 \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0435 \u201curl\u201d json, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0435\u043c \u0437\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432\u043e\u0433\u043e \u043e\u043a\u043d\u0430:<\/p>\n<pre><code class=\"python\">\"url\": f\"{webhook_host}:{webhook_external_port}\/hooks\/adv_search\"<\/code><\/pre>\n<p>\u0423\u0441\u043b\u043e\u0432\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0443\u044e\u0441\u044f \u0441\u0445\u0435\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e81\/260\/381\/e812603819fc5b35034b9b46d6b3fdf8.png\" alt=\"\" title=\"\" width=\"751\" height=\"241\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e81\/260\/381\/e812603819fc5b35034b9b46d6b3fdf8.png\"\/><\/figure>\n<p>\u0421\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u0441\u043b\u0438 \u043d\u0430\u0448 \u0431\u043e\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u043d\u0435 \u043d\u0430 \u043c\u0430\u0448\u0438\u043d\u0435, \u0433\u0434\u0435 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442 mattermost, \u0442\u043e \u0443 \u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0430\u0434\u0440\u0435\u0441\u0443 \u0438 \u043f\u043e\u0440\u0442\u0443, \u0433\u0434\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0432\u0435\u0431\u0445\u0443\u043a-\u0441\u0435\u0440\u0432\u0435\u0440 \u0431\u043e\u0442\u0430. \u0410 \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0430\u043c\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430 mattermost \u0434\u043e\u043b\u0436\u043d\u043e \u0441\u0442\u043e\u044f\u0442\u044c \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430 \u043f\u0440\u0438\u043d\u044f\u0442\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0441 \u0430\u0434\u0440\u0435\u0441\u0430 \u0432\u0435\u0431\u0445\u0443\u043a-\u0441\u0435\u0440\u0432\u0435\u0440\u0430.<\/p>\n<h2>\u041d\u0443 \u0432\u043e\u0442 \u0438 \u0431\u043e\u0442<\/h2>\n<p>\u0412\u043e\u0442 \u0442\u0430\u043a \u0443 \u043d\u0430\u0441 \u0438 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0447\u0430\u0442-\u0431\u043e\u0442, \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u043a\u0440\u0443\u0433\u043b\u043e\u0441\u0443\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0432 \u043b\u0438\u0447\u043d\u044b\u0439 \u0447\u0430\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.\u00a0<\/p>\n<p>\u041e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0441\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043f\u043e\u0434\u043e\u0431\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u0432\u043e\u0441\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0439 \u043a \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043d\u0430 \u0431\u0430\u0437\u0435 \u044d\u0442\u043e\u0433\u043e \u0441\u0442\u0435\u043a\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0443\u0436\u0435 \u0442\u0440\u0435\u0442\u0438\u0439 \u0431\u043e\u0442. \u0412\u0441\u0435 \u043e\u043d\u0438 \u0438\u043c\u0435\u044e\u0442 \u0440\u0430\u0437\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u043d\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u2014 \u201c\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c-mattermost-\u0431\u043e\u0442\u201d \u2014 \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u0439 \u0436\u0435.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/727246\/\"> https:\/\/habr.com\/ru\/articles\/727246\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442! \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0435\u043c, \u043a\u0430\u043a \u043c\u044b \u0432 <a href=\"http:\/\/hh.ru\">hh.ru<\/a> \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0443\u0434\u043e\u0431\u043d\u043e\u0435 \u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0441 \u043a\u043e\u0440\u043f\u043e\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 wiki \u0432 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u043a\u043e\u043c\u043c\u0443\u043d\u0438\u043a\u0430\u0446\u0438\u0438 \u2014 \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0447\u0430\u0442-\u0431\u043e\u0442\u0430 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0439 \u0431\u0430\u0437\u0435 \u0437\u043d\u0430\u043d\u0438\u0439. \u0414\u043b\u044f \u043d\u0430\u0441 \u0442\u0435\u043c\u0430 \u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439, \u043c\u043e\u0436\u0435\u0442 \u0438 \u0432\u0430\u043c \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f.<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e \u043a\u043e\u043c\u043c\u0443\u043d\u0438\u043a\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u043e\u0432\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434 \u0443 \u043d\u0430\u0441 \u2014 <a href=\"https:\/\/mattermost.com\/\"><u>mattermost<\/u><\/a>. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0431\u0430\u0437\u044b \u0437\u043d\u0430\u043d\u0438\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <a href=\"https:\/\/www.atlassian.com\/software\/confluence\"><u>Confluence<\/u><\/a>. \u041d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u0439 \u043f\u043e\u0438\u0441\u043a Confluence \u0438\u043c\u0435\u0435\u0442 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u0430 \u043d\u0430\u043c \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0438 \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430. \u0414\u043b\u044f \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u0438 \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0432 \u043d\u0430\u0448\u0435\u0439 \u043e\u0431\u0448\u0438\u0440\u043d\u043e\u0439 \u0431\u0430\u0437\u0435 \u0437\u043d\u0430\u043d\u0438\u0439 \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0447\u0430\u0442-\u0431\u043e\u0442\u0430 \u0432 mattermost. \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u0431\u043e\u0442\u0430 \u0441\u0442\u0430\u043b \u0432\u044b\u0432\u043e\u0434 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u043f\u043e\u0438\u0441\u043a\u0430 \u0432 \u043b\u0438\u0447\u043d\u044b\u0439 \u0447\u0430\u0442 \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c. \u0411\u043e\u0442\u0430 \u043f\u0438\u0441\u0430\u043b\u0438 \u043d\u0430 Python: \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0431\u0430\u0437\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a mmpy_bot, \u0430 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 confluence \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f confluenceAPI.\u00a0\u00a0<\/p>\n<h2>\u041a\u043e\u0440\u043e\u0442\u043a\u043e \u043e mmpy_bot \u0438 confluenceAPI<\/h2>\n<p>\u0424\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a mmpy_bot \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0432\u044b\u0437\u043e\u0432\u0430\u043c\u0438 API mattermost \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440\u043e\u0432 \u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0445 \u043b\u043e\u0433\u0438\u043a\u0443 \u0431\u043e\u0442\u0430 \u2014 \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u0432. \u0422\u0430\u043a\u0436\u0435 \u0431\u043e\u0442 \u0438\u043c\u0435\u0435\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0432\u0435\u0431\u0445\u0443\u043a-\u0441\u0435\u0440\u0432\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043e\u043c. \u0421 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f <a href=\"https:\/\/mmpy-bot.readthedocs.io\/en\/latest\/\"><u>\u0437\u0434\u0435\u0441\u044c<\/u><\/a>.\u00a0<\/p>\n<p>\u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440\u044b \u2014 <a class=\"mention\" href=\"\/users\/listen_to\">@listen_to<\/a>, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0439 \u0437\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u0438 <a class=\"mention\" href=\"\/users\/listen_webhook\">@listen_webhook<\/a>, \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0439 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0432\u0435\u0431\u0445\u0443\u043a\u0430\u043c\u0438. \u0414\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0443 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 \u0431\u043e\u0442\u0430 \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430: create_post(), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043d\u043e\u0432\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432 \u043a\u0430\u043d\u0430\u043b\u0435, \u0438 reply_to(), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0443 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0432 \u0442\u0440\u0435\u0434 \u043a \u0438\u043c\u0435\u044e\u0449\u0435\u043c\u0443\u0441\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044e. \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c reply_to().<\/p>\n<p>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 confluence \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/atlassian-python-api.readthedocs.io\/confluence.html\"><u>\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a<\/u><\/a>, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u0438\u043d \u043c\u0435\u0442\u043e\u0434 Confluence.cql(), \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0439 \u0437\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0443 \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 CQL \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 confluence.\u00a0<\/p>\n<h2>\u0417\u0430\u043f\u0443\u0441\u043a \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0431\u043e\u0442\u0430<\/h2>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c \u043a\u0430\u043a \u043d\u0430\u0447\u0430\u0442\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u0431\u043e\u0442\u0430, \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u043e\u043a\u0435\u043d\u044b \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u0432 mattermost \u0438 confluence. \u041f\u043e\u0441\u043b\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0442\u043e\u043a\u0435\u043d\u043e\u0432 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c 2 \u0444\u0430\u0439\u043b\u0430 \u2014 <a href=\"http:\/\/mm-bot.py\">mm-bot.py<\/a>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0431\u043e\u0442 \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043d\u0430\u0448 \u043f\u043b\u0430\u0433\u0438\u043d, \u0438 <a href=\"http:\/\/plugin.py\">plugin.py<\/a>, \u0433\u0434\u0435 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432\u0441\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u0440\u0430\u0431\u043e\u0442\u044b \u0431\u043e\u0442\u0430.<\/p>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u2014 \u0441 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0431\u043e\u0442\u0430:<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">import json import sys  from mmpy_bot import Bot, Settings from plugin import SearchPlugin  try: \u00a0\u00a0\u00a0 with open('config.json', 'r', encoding='utf-8') as config: \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0settings = json.loads(config.read())['wiki-search-bot'] except IOError as e: \u00a0\u00a0\u00a0\u00a0print(f'Unable to read config! Reason: {e}') \u00a0\u00a0\u00a0\u00a0sys.exit(1)  bot = Bot( \u00a0\u00a0\u00a0\u00a0settings=Settings( \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0MATTERMOST_URL=settings['mattermost_host'], \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0MATTERMOST_PORT=settings['mattermost_port'], \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0MATTERMOST_API_PATH='\/api\/v4', \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0BOT_TOKEN=settings['mattermost_token'], \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0BOT_TEAM=settings['team_name'], \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0SSL_VERIFY=False, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0WEBHOOK_HOST_ENABLED=True, \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0WEBHOOK_HOST_URL=settings['webhook_host'], \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0WEBHOOK_HOST_PORT=settings['webhook_self_port'], \u00a0\u00a0\u00a0\u00a0), \u00a0\u00a0\u00a0\u00a0plugins=[SearchPlugin()], ) bot.run()<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0447\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442. \u0412 \u0441\u0430\u043c\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0435 \u043c\u044b \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u0431\u043e\u0442\u0430 \u0438\u0437 json \u0441 \u043a\u043e\u043d\u0444\u0438\u0433\u0430\u043c\u0438. \u0421\u0430\u043c \u043a\u043e\u043d\u0444\u0438\u0433 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">{ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"mattermost_host\": \"https:\/\/\u0430\u0434\u0440\u0435\u0441.\u0441\u0435\u0440\u0432\u0435\u0440\u0430.\u043c\u0430\u0442\u0442\u0435\u0440\u043c\u043e\u0441\u0442\", \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"mattermost_port\": \"\u043f\u043e\u0440\u0442.\u0441\u0435\u0440\u0432\u0435\u0440\u0430.\u043c\u0430\u0442\u0442\u0435\u0440\u043c\u043e\u0441\u0442\", \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"mattermost_token\": \"\u0442\u043e\u043a\u0435\u043d_\u0431\u043e\u0442\u0430_mattermost\", \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"team_name\": \"\u0438\u043c\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b\", \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"webhook_host\": \"http:\/\/\u0430\u0434\u0440\u0435\u0441.\u0445\u043e\u0441\u0442\u0430\", \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"webhook_self_port\": \"8579\", \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"webhook_external_port\": \"8579\", \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"confluence_url\": \"https:\/\/\u0430\u0434\u0440\u0435\u0441.\u0431\u0430\u0437\u044b.\u0437\u043d\u0430\u043d\u0438\u0439\", \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"confluence_token\": \"\u0442\u043e\u043a\u0435\u043d_\u0431\u043e\u0442\u0430_confluence\" }  <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u043d\u0430\u0448\u0435\u0433\u043e \u0431\u043e\u0442\u0430 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438. \u0418\u0437 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0437\u0430 \u0447\u0442\u043e \u043e\u043d\u0438 \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0442 \u0438 \u0434\u043b\u044f \u0447\u0435\u0433\u043e \u043d\u0443\u0436\u043d\u044b. \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u0431\u043b\u043e\u043a \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 WEBHOOK_% \u2014 \u043e\u043d\u0438 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u0435\u0431\u0445\u0443\u043a-\u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u041d\u043e \u043e\u0431 \u044d\u0442\u043e\u043c \u043f\u043e\u0437\u0436\u0435. \u041f\u043e\u0441\u043b\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0437\u0430\u043f\u0443\u0441\u043a \u0431\u043e\u0442\u0430 \u0447\u0435\u0440\u0435\u0437 \u0432\u044b\u0437\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u0430 run(). \u0421\u0430\u043c \u0431\u043e\u0442 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 <em>python mm_bot.py<\/em>.<\/p>\n<h2>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0440\u0430\u0431\u043e\u0442\u044b \u0431\u043e\u0442\u0430<\/h2>\n<p>\u0418\u0442\u0430\u043a, \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0432\u044b\u0431\u0440\u0430\u043d\u044b, \u0431\u043e\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d \u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0443. \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0434\u043e \u043f\u0440\u043e\u0434\u0443\u043c\u0430\u0442\u044c \u043b\u043e\u0433\u0438\u043a\u0443 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u0431\u043e\u0442\u043e\u043c \u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u044b.<\/p>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e. \u041e\u0431\u0449\u0430\u0442\u044c\u0441\u044f \u0441 \u0431\u043e\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0435\u0440\u0435\u0437 \u043b\u0438\u0447\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u2014 \u043f\u0443\u0442\u0435\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0441 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u043b\u0430\u0433\u0438\u043d\u0435 \u0434\u043b\u044f \u0431\u043e\u0442\u0430 \u2014 \u0444\u0430\u0439\u043b\u0435 <a href=\"http:\/\/plugin.py\">plugin.py<\/a>. \u041e\u0434\u043d\u0430\u043a\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0438 \u043d\u0435 \u0437\u043d\u0430\u0442\u044c \u043e \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0441\u043b\u043e\u0432, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043b\u044e\u0431\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0441\u043b\u043e\u0432\u0430. \u0422\u0430\u043a\u043e\u0439 \u043c\u0435\u0442\u043e\u0434-\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u0443\u044e \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0443 \u043f\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e \u0431\u043e\u0442\u0430.<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u0448\u0438\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u043c \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 <a class=\"mention\" href=\"\/users\/listen_to\">@listen_to<\/a>(). \u041e\u043d \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0431\u043e\u0442\u0443 \u201c\u0441\u043b\u0443\u0448\u0430\u0442\u044c\u201d \u043a\u0430\u043d\u0430\u043b\u044b, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043d \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d, \u043d\u0430 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440\u0430. \u0412 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u2014 \u044d\u0442\u043e \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0449\u0435\u0435 \u043b\u044e\u0431\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043a\u0440\u043e\u043c\u0435 \u201c\u041d\u0430\u0439\u0434\u0438\u201d. \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440\u0430 \u043c\u043e\u0436\u0435\u0442 \u0432\u0430\u0440\u044c\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 capture group \u0432 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043a\u0435.\u00a0<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">@listen_to(\"^((?!\u041d\u0430\u0439\u0434\u0438).)*$\", re.IGNORECASE) async def hello(self, message: Message, status):         blocks = [             Section(                 title=f'\u041f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e!',                 text=f'\u042f \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u044e \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u0431\u0430\u0437\u0435 \u0437\u043d\u0430\u043d\u0438\u0439 [wiki]({confluence_url}). \u041f\u043e\u0438\u0441\u043a \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u043c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\u043c.\\n\u0427\u0442\u043e\u0431\u044b \u043d\u0430\u0447\u0430\u0442\u044c \u043f\u043e\u0438\u0441\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0441\u043b\u043e\u0432\u043e **\u041d\u0430\u0439\u0434\u0438** \u0438 \u0432\u0430\u0448 \u0437\u0430\u043f\u0440\u043e\u0441, \u043f\u0440\u0438\u043c\u0435\u0440: **\u041d\u0430\u0439\u0434\u0438 \u0446\u0435\u043b\u0438 \u0438 \u043f\u043b\u0430\u043d\u044b**',                 ])))         ]         mes_json = {'attachments': [block.asdict() for block in blocks]}         self.driver.reply_to(message, '', props=mes_json) <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p><em>\u0422\u0443\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b \u043f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u044f. \u0412 \u0441\u0430\u043c\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0447\u0442\u043e-\u0442\u043e \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e\u0435. \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0442\u0430\u043a \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0442\u0441\u044f <\/em><a href=\"https:\/\/developers.mattermost.com\/integrate\/plugins\/interactive-messages\/\"><em><u>\u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f<\/u><\/em><\/a><em>. \u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u0430\u043a\u0438\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0431\u044b\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u044b \u0434\u0430\u0442\u0430\u043a\u043b\u0430\u0441\u0441\u044b:<\/em><\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">@dataclass class Field: \u00a0\u00a0\u00a0\u00a0title: str \u00a0\u00a0\u00a0\u00a0value: str \u00a0\u00a0\u00a0\u00a0short: bool = True  @dataclass class Section: \u00a0\u00a0\u00a0\u00a0title: Optional[str] = None \u00a0\u00a0\u00a0\u00a0text: Optional[str] = None \u00a0\u00a0\u00a0\u00a0fields: Optional[List[Field]] = None  \u00a0\u00a0\u00a0\u00a0def asdict(self): \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0res = {} \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if self.fields: \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0res['fields'] = [asdict(field) for field in self.fields] \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if self.title: \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0res['title'] = str(self.title) \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if self.text: \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0res['text'] = str(self.text)  \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return res<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c \u0432 \u0431\u043e\u0442\u0435 \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e:<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">@listen_to(\"^((?!\u041d\u0430\u0439\u0434\u0438).)*$\", re.IGNORECASE) async def hello(self, message: Message, status):         blocks = [             Section(                 title=f'\u041f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e!',                 text=f'\u042f \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u044e \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u0431\u0430\u0437\u0435 \u0437\u043d\u0430\u043d\u0438\u0439 [wiki]({confluence_url}). \u041f\u043e\u0438\u0441\u043a \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u043c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\u043c.\\n\u0427\u0442\u043e\u0431\u044b \u043d\u0430\u0447\u0430\u0442\u044c \u043f\u043e\u0438\u0441\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0441\u043b\u043e\u0432\u043e **\u041d\u0430\u0439\u0434\u0438** \u0438 \u0432\u0430\u0448 \u0437\u0430\u043f\u0440\u043e\u0441, \u043f\u0440\u0438\u043c\u0435\u0440: **\u041d\u0430\u0439\u0434\u0438 \u0446\u0435\u043b\u0438 \u0438 \u043f\u043b\u0430\u043d\u044b**',                 fields=list(filter(None, [                     Field(title='\u041f\u043e\u0438\u0441\u043a \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u043f\u0440\u0435\u0434\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438:', value='', short=False),                     Field(title='\u041f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430', value='QA, DEV'),                     Field(title='\u041f\u0435\u0440\u0438\u043e\u0434', value='\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0433\u043e\u0434'),                     Field(title='\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435', value='\u0421\u0442\u0440\u0430\u043d\u0438\u0446\u0430'),                 )         ]         mes_json = {'attachments': [block.asdict() for block in blocks]}         self.driver.reply_to(message, '', props=mes_json)<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043c\u044b \u043f\u0440\u043e\u0438\u043d\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043b\u0438. \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0434\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0438\u0441\u043a \u0432 \u0431\u0430\u0437\u0435 \u0437\u043d\u0430\u043d\u0438\u0439. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 \u201c\u041d\u0430\u0439\u0434\u0438\u201d:<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">    @listen_to(\"\u041d\u0430\u0439\u0434\u0438 (.*)\", re.IGNORECASE)     async def search(self, message: Message, text_to_search):         search_result = []         log.info(f'\u0417\u0430\u043f\u0440\u043e\u0448\u0435\u043d \u043f\u043e\u0438\u0441\u043a \"{text_to_search}\"')         search = Search(search_text=text_to_search)         query = SearchQuery(search_text=text_to_search)          label_response = search_by_label(text_to_search)         find_response = self.query(query)          if label_response != '':             label_search_result = label_response             for res in find_response['results']:                 for label_res in label_search_result['results']:                     if label_res['content']['id'] == res['content']['id']:                         search_result.append(res)              for res in find_response['results']:                 flag = False                 for label_res in label_search_result['results']:                     if label_res['content']['id'] == res['content']['id']:                         flag = True                 if not flag:                     search_result.append(res)         else:             search_result = find_response['results']          search.search_results = search_result         self.print_search_result(message, search)<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0412 \u043c\u0435\u0442\u043e\u0434\u0435 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u044b\u0437\u043e\u0432 \u0434\u0432\u0443\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 search_by_label() \u0438 self.query():<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">def search_by_label(label_text):     confluence = Confluence(url=confluence_url, token=confluence_token)     cql = f'type=\"page\" AND label=\"{label_text}\"'     try:         response = confluence.cql(cql, start=0, limit=100, expand=None, include_archived_spaces=None, excerpt=None)         return response     except Exception as e:         log.error(f'Unable to parse cql query. Reason: {e} cql: {cql}')     return ''<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041e\u0431\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0442 \u0437\u0430 \u043f\u043e\u0438\u0441\u043a \u0432 \u0431\u0430\u0437\u0435 \u0437\u043d\u0430\u043d\u0438\u0439, \u043d\u043e search_by_label() \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u043e\u0441\u043e\u0431\u044b\u0439 cql-\u0437\u0430\u043f\u0440\u043e\u0441, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0439 \u0437\u0430 \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u043c\u0435\u0442\u043a\u0430\u043c\/\u043b\u0435\u0439\u0431\u043b\u0430\u043c (labels) \u0441\u0442\u0430\u0442\u0435\u0439, \u0442\u043e \u0435\u0441\u0442\u044c \u043d\u0443\u0436\u043d\u0430\u044f \u0444\u0440\u0430\u0437\u0430 \u0438\u0449\u0435\u0442\u0441\u044f \u0441\u0440\u0435\u0434\u0438 \u043c\u0435\u0442\u043e\u043a. \u0422\u0430\u043a\u043e\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043e\u0431\u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043e \u0436\u0435\u043b\u0430\u043d\u0438\u0435\u043c \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u044b\u0434\u0430\u0447\u0443 \u0441\u0442\u0430\u0442\u0435\u0439 \u0441 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u043c\u0438 \u043c\u0435\u0442\u043a\u0430\u043c\u0438 \u0432 \u043e\u0442\u0432\u0435\u0442\u0435 \u0431\u043e\u0442\u0430. \u0412 \u043c\u0435\u0442\u043e\u0434\u0435 query() \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 cql-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u043d\u0430\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0438 \u0432\u044b\u0437\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u0430 advanced_search_on_wiki() \u0434\u043b\u044f \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0438\u0441\u043a\u0430.<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">def query(self, query: SearchQuery):         period_postfix = ''         space_list = []         content_list = []         content_postfix = ''         space_postfix = ''         label_postfix = ''         title_postfix = ''          period_postfix = f' and lastmodified > {query.modify_period}'         if query.HHQA:             space_list.append('\"HHQA\"')         if query.HHDEV:<\/code><\/pre>\n<\/div>\n<\/details>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-396827","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/396827","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=396827"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/396827\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=396827"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=396827"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=396827"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}