Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def broadcast(message):
- uid = message.from_user.id
- caption = message.html_caption
- content_type = message.content_type
- mestext = message.html_text
- file_id = ''
- if content_type == "text":
- bot.send_message(uid, mestext, parse_mode="HTML")
- elif content_type == "photo":
- file_id = message.photo[-1].file_id
- if caption:
- bot.send_photo(uid, file_id, caption=caption, parse_mode="HTML")
- else:
- bot.send_photo(uid, file_id)
- elif content_type == "video":
- file_id = message.video.file_id
- if caption:
- bot.send_video(uid, file_id, caption=caption, parse_mode="HTML")
- else:
- bot.send_video(uid, file_id)
- elif content_type == "document":
- file_id = message.document.file_id
- if caption:
- bot.send_document(uid, file_id, caption=caption, parse_mode="HTML")
- else:
- bot.send_document(uid, file_id)
- elif content_type == "animation":
- file_id = message.animation.file_id
- if caption:
- bot.send_animation(uid, file_id, caption=caption, parse_mode="HTML")
- else:
- bot.send_animation(uid, file_id)
- else:
- bot.send_message(uid, "Неподдерживаемый тип сообщения")
- markup = types.ReplyKeyboardMarkup(True)
- markup.row("Добавить кнопку")
- markup.row("Отправить рассылку")
- btns = {}
- msg = bot.send_message(uid, "Ок, дальше?", reply_markup=markup)
- bot.register_next_step_handler(msg, ready, content_type, mestext, caption, file_id, btns)
Advertisement
Add Comment
Please, Sign In to add comment