{"id":385137,"date":"2024-06-29T05:55:46","date_gmt":"2024-06-29T05:55:46","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=385137"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=385137","title":{"rendered":"<span>telebot \u0431\u044b\u0441\u0442\u0440\u043e \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u043e. \u0422\u0435\u043b\u0435\u0433\u0440\u0430\u043c\u043c-\u0431\u043e\u0442<\/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>telebot (pyTelegramBotAPI) \u0445\u043e\u0440\u043e\u0448\u0430\u044f \u0438 \u043b\u0451\u0433\u043a\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0431\u043e\u0442\u0430 \u043d\u0430 python \u0434\u043b\u044f \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c\u043c\u0430.<\/p>\n<h2>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/h2>\n<p>\u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 windows, \u0442\u043e\u0433\u0434\u0430 \u0432\u0430\u043c \u043d\u0430\u0434\u043e \u043d\u0430\u0439\u0442\u0438 cmd \u043d\u0430 \u0441\u0432\u043e\u0451\u043c \u043f\u043a, \u0430 \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 macOS, \u0442\u043e\u0433\u0434\u0430 \u0432\u0430\u043c \u043d\u0430\u0434\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b. <\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/aca\/979\/4c5\/aca9794c5332f0ae429bd1d3d64e8739.jpg\" width=\"134\" height=\"138\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/aca\/979\/4c5\/aca9794c5332f0ae429bd1d3d64e8739.jpg\" data-blurred=\"true\"\/><\/figure>\n<p>\u0414\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 telebot (pyTelegramBotAPI) \u043d\u0430 windows \u0432\u0430\u043c \u043d\u0430\u0434\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432 cmd<\/p>\n<pre><code>pip install pyTelegramBotAPI<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043d\u0430 macOS \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0435<\/p>\n<pre><code>pip3 install pyTelegramBotAPI<\/code><\/pre>\n<h2>\u041d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043a\u043e\u0434\u0430<\/h2>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u0434\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u043e\u043a\u0435\u043d. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u0439\u0434\u0451\u043c \u043a \u0431\u043e\u0442\u0443 botfather,\u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u043e\u043a\u0435\u043d (<a href=\"https:\/\/t.me\/BotFather\" rel=\"noopener noreferrer nofollow\">botfather<\/a>)<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0447\u0430\u0442\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434.\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443.<\/p>\n<pre><code class=\"python\">import telebot token=\"\u043d\u0430\u0448 \u0442\u043e\u043a\u0435\u043d\"<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c token, \u0432 \u043d\u0435\u0439 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043d\u0430\u0448 \u0442\u043e\u043a\u0435\u043d.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u0431\u043e\u0442\u0430:<\/p>\n<pre><code class=\"python\">import telebot token='\u043d\u0430\u0448 \u0442\u043e\u043a\u0435\u043d' bot=telebot.TeleBot(token) @bot.message_handler(commands=['start']) def start_message(message):   bot.send_message(message.chat.id,\"\u041f\u0440\u0438\u0432\u0435\u0442 \u270c\ufe0f \") bot.infinity_poling()<\/code><\/pre>\n<p>\u041d\u0430\u043c \u043d\u0430\u0434\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e bot, \u0432 \u043d\u0435\u0439 \u043c\u044b \u043f\u0438\u0448\u0435\u043c telebot.Telebot (\u043d\u0430\u0448\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0441 \u0442\u043e\u043a\u0435\u043d\u043e\u043c).<\/p>\n<p>\u041f\u0438\u0448\u0435\u043c @bot.message_handler(commands=[&#8216;start&#8217;])<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c &#171;start_message&#187;<\/p>\n<p>\u0412 \u0441\u043a\u043e\u0431\u043a\u0430\u0445 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c &#171;message&#187;.<\/p>\n<p>\u041f\u0438\u0448\u0435\u043c \u0432\u043d\u0443\u0442\u0440\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 bot.send_message(message.chat.id,&#187;\u041f\u0440\u0438\u0432\u0435\u0442&#187;)<\/p>\n<p>\u0438 \u0432\u043d\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0438\u0448\u0435\u043c bot.infinity_poling()<\/p>\n<p>\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0448 \u0431\u043e\u0442 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c<\/p>\n<p>\u0432\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/299\/9c5\/6f4\/2999c56f4ad13be98432190539786d40.png\" width=\"732\" height=\"844\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/299\/9c5\/6f4\/2999c56f4ad13be98432190539786d40.png\"\/><\/figure>\n<p>\u041f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438, \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043a\u043d\u043e\u043f\u043a\u0443.<\/p>\n<p>\u041d\u0430\u0434\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c from telebot import types \u0442\u0430\u043c \u0436\u0435, \u0433\u0434\u0435 \u043c\u044b \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 telebot<\/p>\n<pre><code class=\"python\">import telebot from telebot import types token='\u043d\u0430\u0448 \u0442\u043e\u043a\u0435\u043d' bot=telebot.TeleBot(token) @bot.message_handler(commands=['start']) def start_message(message): bot.send_message(message.chat.id,'\u041f\u0440\u0438\u0432\u0435\u0442') @bot.message_handler(commands=['button']) def button_message(message): markup=types.ReplyKeyboardMarkup(resize_keyboard=True) item1=types.KeyboardButton(\"\u041a\u043d\u043e\u043f\u043a\u0430\")   markup.add(item1)bot.send_message(message.chat.id,'\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0447\u0442\u043e \u0432\u0430\u043c \u043d\u0430\u0434\u043e',reply_markup=markup) bot.infinity_polling()<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0438\u0448\u0435\u043c @bot.message_handler(commands=[&#8216;button&#8217;]). \u0414\u0430\u043b\u044c\u0448\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c button_message, \u0432 \u0441\u043a\u043e\u0431\u043a\u0430\u0445 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c message.<\/p>\n<p>\u0414\u0430\u043b\u044c\u0448\u0435 \u043d\u0430\u0434\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0443 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c markup, \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043f\u0438\u0448\u0435\u043c types.ReplyKeyboardMarkup(resize_keyboard=True).<\/p>\n<p>\u041f\u043e\u0442\u043e\u043c \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e item1, \u0432 \u043d\u0435\u0439 \u0431\u0443\u0434\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0441\u0430\u043c\u0430 \u043a\u043d\u043e\u043f\u043a\u0430 \u0438 \u043f\u0438\u0448\u0435\u043c \u0447\u0442\u043e item1=types.KeyboardButton(&#171;\u0442\u0435\u043a\u0441\u0442 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0435&#187;).<\/p>\n<p>\u0414\u0430\u043b\u044c\u0448\u0435 \u043a \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u0430\u0448\u0443 \u043a\u043d\u043e\u043f\u043a\u0443<\/p>\n<pre><code class=\"python\">markup.add(item1)<\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043d\u0430\u0434\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 &#171;\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0447\u0442\u043e \u0432\u0430\u043c \u043d\u0430\u0434\u043e&#187; \u0438 \u043f\u043e\u0441\u043b\u0435 \u0442\u0435\u043a\u0441\u0442\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c reply_markup=markup \u0438 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0441\u043a\u043e\u0431\u043a\u0438.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043a\u043d\u043e\u043f\u043a\u0430. \u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ec2\/3e8\/bfc\/ec23e8bfce51faec092733d4d92e60a4.png\" width=\"732\" height=\"430\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ec2\/3e8\/bfc\/ec23e8bfce51faec092733d4d92e60a4.png\"\/><\/figure>\n<p>\u041d\u043e \u0435\u0441\u043b\u0438 \u043c\u044b \u043d\u0430 \u043d\u0435\u0451 \u043d\u0430\u0436\u043c\u0451\u043c, \u0442\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442. \u0421\u0435\u0439\u0447\u0430\u0441 \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 \u0432\u044b\u0434\u0430\u0432\u0430\u043b\u043e \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043c\u043e\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0432 \u0425\u0430\u0431\u0440\u0435.<\/p>\n<pre><code class=\"python\">import telebot from telebot import types token='\u043d\u0430\u0448 \u0442\u043e\u043a\u0435\u043d' bot=telebot.TeleBot(token) @bot.message_handler(commands=['start']) def start_message(message):     bot.send_message(message.chat.id,'\u041f\u0440\u0438\u0432\u0435\u0442') @bot.message_handler(commands=['button']) def button_message(message):     markup=types.ReplyKeyboardMarkup(resize_keyboard=True)     item1=types.KeyboardButton(\"\u041a\u043d\u043e\u043f\u043a\u0430\")     markup.add(item1)     bot.send_message(message.chat.id,'\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0447\u0442\u043e \u0432\u0430\u043c \u043d\u0430\u0434\u043e',reply_markup=markup) @bot.message_handler(content_types='text') def message_reply(message):     if message.text==\"\u041a\u043d\u043e\u043f\u043a\u0430\":         bot.send_message(message.chat.id,\"https:\/\/habr.com\/ru\/users\/lubaznatel\/\") bot.infinity_polling()<\/code><\/pre>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u043d\u0430\u043f\u0438\u0448\u0435\u043c @bot.message_handler(content_types=&#8217;text&#8217;)<\/p>\n<p>\u0414\u0430\u043b\u044c\u0448\u0435 \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c message_reply, \u0430 \u0432 \u0441\u043a\u043e\u0431\u043a\u0430\u0445 \u0443\u043a\u0430\u0437\u0430\u0442\u044c message.<\/p>\n<p>\u0412\u043d\u0443\u0442\u0440\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0430\u0434\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0443\u0441\u043b\u043e\u0432\u0438\u0435 &#171;if message.text==&#187;\u041a\u043d\u043e\u043f\u043a\u0430:&#187;, \u0430 \u0432\u043d\u0443\u0442\u0440\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435.<\/p>\n<p>\u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/688\/366\/308\/688366308fbed3955df3d17847111266.png\" width=\"732\" height=\"778\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/688\/366\/308\/688366308fbed3955df3d17847111266.png\"\/><\/figure>\n<h2>\u0421\u043c\u0435\u043d\u0430 \u043a\u043d\u043e\u043f\u043e\u043a<\/h2>\n<p>\u042d\u0442\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0447\u0430\u0441\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u0438.\u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u0441 \u0432\u0430\u043c\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432 \u0433\u0440\u0443\u043f\u043f\u0443 \u0438\u043b\u0438 \u043a\u0430\u043d\u0430\u043b.<\/p>\n<p>\u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u0430\u043c\u0430\u044f \u043b\u0451\u0433\u043a\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<p>\u041c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u0441\u0435\u0439\u0447\u0430\u0441 \u0441 \u0432\u0430\u043c\u0438 \u0437\u0430\u043c\u0435\u043d\u0443 \u043a\u043d\u043e\u043f\u043e\u043a.<\/p>\n<pre><code class=\"python\">import telebot from telebot import types token='\u043d\u0430\u0448 \u0442\u043e\u043a\u0435\u043d' bot=telebot.TeleBot(token) @bot.message_handler(commands=['start']) def start_message(message):     bot.send_message(message.chat.id,'\u041f\u0440\u0438\u0432\u0435\u0442') @bot.message_handler(commands=['button']) def button_message(message):     markup=types.ReplyKeyboardMarkup(resize_keyboard=True)     item1=types.KeyboardButton(\"\u041a\u043d\u043e\u043f\u043a\u0430\")     markup.add(item1)     bot.send_message(message.chat.id,'\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0447\u0442\u043e \u0432\u0430\u043c \u043d\u0430\u0434\u043e',reply_markup=markup) @bot.message_handler(content_types='text') def message_reply(message):     if message.text==\"\u041a\u043d\u043e\u043f\u043a\u0430\":         markup=types.ReplyKeyboardMarkup(resize_keyboard=True)         item1=types.KeyboardButton(\"\u041a\u043d\u043e\u043f\u043a\u0430 2\")         markup.add(item1)         bot.send_message(message.chat.id,'\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0447\u0442\u043e \u0432\u0430\u043c \u043d\u0430\u0434\u043e',reply_markup=markup)     elif message.text==\"\u041a\u043d\u043e\u043f\u043a\u0430 2\":         bot.send_message(message.chat.id,'\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438!') bot.infinity_polling()<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u0434\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0443 \u0441 \u043a\u043d\u043e\u043f\u043a\u0430\u043c\u0438 \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0435 \u043a\u043d\u043e\u043f\u043a\u0443 \u043a\u0430\u043a \u0432 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0432 \u0442\u043e\u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435.\u0414\u0430\u043b\u044c\u0448\u0435 \u0432 \u0442\u043e\u0439 \u0436\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c:<\/p>\n<pre><code class=\"python\">elif message.text==\"\u041a\u043d\u043e\u043f\u043a\u0430 2\": bot.send_message(message.chat.id,'\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438!')<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 \u041a\u043d\u043e\u043f\u043a\u0443 1 \u043e\u043d\u0430 \u0443 \u043d\u0430\u0441 \u0441\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 2 \u0438 \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 2 \u0443 \u043d\u0430\u0441 \u043f\u0440\u0438\u0441\u044b\u043b\u0430\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 &#171;\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438!&#187;.<\/p>\n<p>\u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/11f\/bf9\/3e6\/11fbf93e68c90dda32b3aed6d76aef91.png\" width=\"732\" height=\"410\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/11f\/bf9\/3e6\/11fbf93e68c90dda32b3aed6d76aef91.png\"\/><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e18\/fed\/bf3\/e18fedbf36a80083d563c59a952e3d90.png\" width=\"732\" height=\"322\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e18\/fed\/bf3\/e18fedbf36a80083d563c59a952e3d90.png\"\/><\/figure>\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\/580408\/\"> https:\/\/habr.com\/ru\/articles\/580408\/<\/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>telebot (pyTelegramBotAPI) \u0445\u043e\u0440\u043e\u0448\u0430\u044f \u0438 \u043b\u0451\u0433\u043a\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0431\u043e\u0442\u0430 \u043d\u0430 python \u0434\u043b\u044f \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c\u043c\u0430.<\/p>\n<h2>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/h2>\n<p>\u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 windows, \u0442\u043e\u0433\u0434\u0430 \u0432\u0430\u043c \u043d\u0430\u0434\u043e \u043d\u0430\u0439\u0442\u0438 cmd \u043d\u0430 \u0441\u0432\u043e\u0451\u043c \u043f\u043a, \u0430 \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 macOS, \u0442\u043e\u0433\u0434\u0430 \u0432\u0430\u043c \u043d\u0430\u0434\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b. <\/p>\n<figure class=\"\"><\/figure>\n<p>\u0414\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 telebot (pyTelegramBotAPI) \u043d\u0430 windows \u0432\u0430\u043c \u043d\u0430\u0434\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432 cmd<\/p>\n<pre><code>pip install pyTelegramBotAPI<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043d\u0430 macOS \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0435<\/p>\n<pre><code>pip3 install pyTelegramBotAPI<\/code><\/pre>\n<h2>\u041d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043a\u043e\u0434\u0430<\/h2>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u0434\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u043e\u043a\u0435\u043d. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u0439\u0434\u0451\u043c \u043a \u0431\u043e\u0442\u0443 botfather,\u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u043e\u043a\u0435\u043d (<a href=\"https:\/\/t.me\/BotFather\" rel=\"noopener noreferrer nofollow\">botfather<\/a>)<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0447\u0430\u0442\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434.\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443.<\/p>\n<pre><code class=\"python\">import telebot token=\"\u043d\u0430\u0448 \u0442\u043e\u043a\u0435\u043d\"<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c token, \u0432 \u043d\u0435\u0439 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043d\u0430\u0448 \u0442\u043e\u043a\u0435\u043d.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u0431\u043e\u0442\u0430:<\/p>\n<pre><code class=\"python\">import telebot token='\u043d\u0430\u0448 \u0442\u043e\u043a\u0435\u043d' bot=telebot.TeleBot(token) @bot.message_handler(commands=['start']) def start_message(message):   bot.send_message(message.chat.id,\"\u041f\u0440\u0438\u0432\u0435\u0442 \u270c\ufe0f \") bot.infinity_poling()<\/code><\/pre>\n<p>\u041d\u0430\u043c \u043d\u0430\u0434\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e bot, \u0432 \u043d\u0435\u0439 \u043c\u044b \u043f\u0438\u0448\u0435\u043c telebot.Telebot (\u043d\u0430\u0448\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0441 \u0442\u043e\u043a\u0435\u043d\u043e\u043c).<\/p>\n<p>\u041f\u0438\u0448\u0435\u043c @bot.message_handler(commands=[&#8216;start&#8217;])<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c &#171;start_message&#187;<\/p>\n<p>\u0412 \u0441\u043a\u043e\u0431\u043a\u0430\u0445 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c &#171;message&#187;.<\/p>\n<p>\u041f\u0438\u0448\u0435\u043c \u0432\u043d\u0443\u0442\u0440\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 bot.send_message(message.chat.id,&#187;\u041f\u0440\u0438\u0432\u0435\u0442&#187;)<\/p>\n<p>\u0438 \u0432\u043d\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0438\u0448\u0435\u043c bot.infinity_poling()<\/p>\n<p>\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0448 \u0431\u043e\u0442 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c<\/p>\n<p>\u0432\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438, \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043a\u043d\u043e\u043f\u043a\u0443.<\/p>\n<p>\u041d\u0430\u0434\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c from telebot import types \u0442\u0430\u043c \u0436\u0435, \u0433\u0434\u0435 \u043c\u044b \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 telebot<\/p>\n<pre><code class=\"python\">import telebot from telebot import types token='\u043d\u0430\u0448 \u0442\u043e\u043a\u0435\u043d' bot=telebot.TeleBot(token) @bot.message_handler(commands=['start']) def start_message(message): bot.send_message(message.chat.id,'\u041f\u0440\u0438\u0432\u0435\u0442') @bot.message_handler(commands=['button']) def button_message(message): markup=types.ReplyKeyboardMarkup(resize_keyboard=True) item1=types.KeyboardButton(\"\u041a\u043d\u043e\u043f\u043a\u0430\")   markup.add(item1)bot.send_message(message.chat.id,'\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0447\u0442\u043e \u0432\u0430\u043c \u043d\u0430\u0434\u043e',reply_markup=markup) bot.infinity_polling()<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0438\u0448\u0435\u043c @bot.message_handler(commands=[&#8216;button&#8217;]). \u0414\u0430\u043b\u044c\u0448\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c button_message, \u0432 \u0441\u043a\u043e\u0431\u043a\u0430\u0445 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c message.<\/p>\n<p>\u0414\u0430\u043b\u044c\u0448\u0435 \u043d\u0430\u0434\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0443 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c markup, \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043f\u0438\u0448\u0435\u043c types.ReplyKeyboardMarkup(resize_keyboard=True).<\/p>\n<p>\u041f\u043e\u0442\u043e\u043c \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e item1, \u0432 \u043d\u0435\u0439 \u0431\u0443\u0434\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0441\u0430\u043c\u0430 \u043a\u043d\u043e\u043f\u043a\u0430 \u0438 \u043f\u0438\u0448\u0435\u043c \u0447\u0442\u043e item1=types.KeyboardButton(&#171;\u0442\u0435\u043a\u0441\u0442 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0435&#187;).<\/p>\n<p>\u0414\u0430\u043b\u044c\u0448\u0435 \u043a \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u0430\u0448\u0443 \u043a\u043d\u043e\u043f\u043a\u0443<\/p>\n<pre><code class=\"python\">markup.add(item1)<\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043d\u0430\u0434\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 &#171;\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0447\u0442\u043e \u0432\u0430\u043c \u043d\u0430\u0434\u043e&#187; \u0438 \u043f\u043e\u0441\u043b\u0435 \u0442\u0435\u043a\u0441\u0442\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c reply_markup=markup \u0438 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0441\u043a\u043e\u0431\u043a\u0438.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043a\u043d\u043e\u043f\u043a\u0430. \u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041d\u043e \u0435\u0441\u043b\u0438 \u043c\u044b \u043d\u0430 \u043d\u0435\u0451 \u043d\u0430\u0436\u043c\u0451\u043c, \u0442\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442. \u0421\u0435\u0439\u0447\u0430\u0441 \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 \u0432\u044b\u0434\u0430\u0432\u0430\u043b\u043e \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043c\u043e\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0432 \u0425\u0430\u0431\u0440\u0435.<\/p>\n<pre><code class=\"python\">import telebot from telebot import types token='\u043d\u0430\u0448 \u0442\u043e\u043a\u0435\u043d' bot=telebot.TeleBot(token) @bot.message_handler(commands=['start']) def start_message(message):     bot.send_message(message.chat.id,'\u041f\u0440\u0438\u0432\u0435\u0442') @bot.message_handler(commands=['button']) def button_message(message):     markup=types.ReplyKeyboardMarkup(resize_keyboard=True)     item1=types.KeyboardButton(\"\u041a\u043d\u043e\u043f\u043a\u0430\")     markup.add(item1)     bot.send_message(message.chat.id,'\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0447\u0442\u043e \u0432\u0430\u043c \u043d\u0430\u0434\u043e',reply_markup=markup) @bot.message_handler(content_types='text') def message_reply(message):     if message.text==\"\u041a\u043d\u043e\u043f\u043a\u0430\":         bot.send_message(message.chat.id,\"https:\/\/habr.com\/ru\/users\/lubaznatel\/\") bot.infinity_polling()<\/code><\/pre>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u043d\u0430\u043f\u0438\u0448\u0435\u043c @bot.message_handler(content_types=&#8217;text&#8217;)<\/p>\n<p>\u0414\u0430\u043b\u044c\u0448\u0435 \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c message_reply, \u0430 \u0432 \u0441\u043a\u043e\u0431\u043a\u0430\u0445 \u0443\u043a\u0430\u0437\u0430\u0442\u044c message.<\/p>\n<p>\u0412\u043d\u0443\u0442\u0440\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0430\u0434\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0443\u0441\u043b\u043e\u0432\u0438\u0435 &#171;if message.text==&#187;\u041a\u043d\u043e\u043f\u043a\u0430:&#187;, \u0430 \u0432\u043d\u0443\u0442\u0440\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435.<\/p>\n<p>\u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<figure class=\"full-width\"><\/figure>\n<h2>\u0421\u043c\u0435\u043d\u0430 \u043a\u043d\u043e\u043f\u043e\u043a<\/h2>\n<p>\u042d\u0442\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0447\u0430\u0441\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u0438.\u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u0441 \u0432\u0430\u043c\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432 \u0433\u0440\u0443\u043f\u043f\u0443 \u0438\u043b\u0438 \u043a\u0430\u043d\u0430\u043b.<\/p>\n<p>\u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u0430\u043c\u0430\u044f \u043b\u0451\u0433\u043a\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<p>\u041c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u0441\u0435\u0439\u0447\u0430\u0441 \u0441 \u0432\u0430\u043c\u0438 \u0437\u0430\u043c\u0435\u043d\u0443 \u043a\u043d\u043e\u043f\u043e\u043a.<\/p>\n<pre><code class=\"python\">import telebot from telebot import types token='\u043d\u0430\u0448 \u0442\u043e\u043a\u0435\u043d' bot=telebot.TeleBot(token) @bot.message_handler(commands=['start']) def start_message(message):     bot.send_message(message.chat.id,'\u041f\u0440\u0438\u0432\u0435\u0442') @bot.message_handler(commands=['button']) def button_message(message):     markup=types.ReplyKeyboardMarkup(resize_keyboard=True)     item1=types.KeyboardButton(\"\u041a\u043d\u043e\u043f\u043a\u0430\")     markup.add(item1)     bot.send_message(message.chat.id,'\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0447\u0442\u043e \u0432\u0430\u043c \u043d\u0430\u0434\u043e',reply_markup=markup) @bot.message_handler(content_types='text') def message_reply(message):     if message.text==\"\u041a\u043d\u043e\u043f\u043a\u0430\":         markup=types.ReplyKeyboardMarkup(resize_keyboard=True)         item1=types.KeyboardButton(\"\u041a\u043d\u043e\u043f\u043a\u0430 2\")         markup.add(item1)         bot.send_message(message.chat.id,'\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0447\u0442\u043e \u0432\u0430\u043c \u043d\u0430\u0434\u043e',reply_markup=markup)     elif message.text==\"\u041a\u043d\u043e\u043f\u043a\u0430 2\":         bot.send_message(message.chat.id,'\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438!') bot.infinity_polling()<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u0434\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0443 \u0441 \u043a\u043d\u043e\u043f\u043a\u0430\u043c\u0438 \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0435 \u043a\u043d\u043e\u043f\u043a\u0443 \u043a\u0430\u043a \u0432 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0432 \u0442\u043e\u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435.\u0414\u0430\u043b\u044c\u0448\u0435 \u0432 \u0442\u043e\u0439 \u0436\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c:<\/p>\n<pre><code class=\"python\">elif message.text==\"\u041a\u043d\u043e\u043f\u043a\u0430 2\": bot.send_message(message.chat.id,'\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438!')<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 \u041a\u043d\u043e\u043f\u043a\u0443 1 \u043e\u043d\u0430 \u0443 \u043d\u0430\u0441 \u0441\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 2 \u0438 \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 2 \u0443 \u043d\u0430\u0441 \u043f\u0440\u0438\u0441\u044b\u043b\u0430\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 &#171;\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438!&#187;.<\/p>\n<p>\u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<figure class=\"full-width\"><\/figure>\n<figure class=\"full-width\"><\/figure>\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\/580408\/\"> https:\/\/habr.com\/ru\/articles\/580408\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-385137","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/385137","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=385137"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/385137\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=385137"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=385137"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=385137"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}