Guest User

Untitled

a guest
Jun 6th, 2021
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.64 KB | None | 0 0
  1. def broadcast(message):
  2.     uid = message.from_user.id
  3.     caption = message.html_caption
  4.     content_type = message.content_type
  5.     mestext = message.html_text
  6.     file_id = ''
  7.     if content_type == "text":
  8.         bot.send_message(uid, mestext, parse_mode="HTML")
  9.     elif content_type == "photo":
  10.         file_id = message.photo[-1].file_id
  11.         if caption:
  12.             bot.send_photo(uid, file_id, caption=caption, parse_mode="HTML")
  13.         else:
  14.             bot.send_photo(uid, file_id)
  15.     elif content_type == "video":
  16.         file_id = message.video.file_id
  17.         if caption:
  18.             bot.send_video(uid, file_id, caption=caption, parse_mode="HTML")
  19.         else:
  20.             bot.send_video(uid, file_id)
  21.     elif content_type == "document":
  22.         file_id = message.document.file_id
  23.         if caption:
  24.             bot.send_document(uid, file_id, caption=caption, parse_mode="HTML")
  25.         else:
  26.             bot.send_document(uid, file_id)
  27.     elif content_type == "animation":
  28.         file_id = message.animation.file_id
  29.         if caption:
  30.             bot.send_animation(uid, file_id, caption=caption, parse_mode="HTML")
  31.         else:
  32.             bot.send_animation(uid, file_id)
  33.     else:
  34.         bot.send_message(uid, "Неподдерживаемый тип сообщения")
  35.     markup = types.ReplyKeyboardMarkup(True)
  36.     markup.row("Добавить кнопку")
  37.     markup.row("Отправить рассылку")
  38.     btns = {}
  39.     msg = bot.send_message(uid, "Ок, дальше?", reply_markup=markup)
  40.     bot.register_next_step_handler(msg, ready, content_type, mestext, caption, file_id, btns)
Advertisement
Add Comment
Please, Sign In to add comment