예제 #1
0
def photo4(message):
    chat_id = message.chat.id
    message_id = message.message_id
    que_photo = message.photo
    try:
        fileId = message.photo[-1].file_id
    except TypeError:
        new_photo = FourChoice.objects.get(pk=qs[chat_id])
        new_photo.delete()
        bot.send_message(chat_id,
                         'Siz rasm yubormadingiz qaytadan boshlang!',
                         reply_markup=start_buttons())
    new_photo = FourChoice.objects.get(pk=qs[chat_id])
    new_photo.image = fileId
    new_photo.message_id = message_id
    new_photo.save()
    savol = new_photo.text
    bot.send_photo(chat_id,
                   fileId,
                   " {} ".format(savol),
                   reply_markup=option_four_markup(message_id))
    sent = bot.send_message(
        chat_id,
        'Savolni ko\'zdan kechiring.Agar sizga ma\'qul bo\'lsa Ha ni tanlang!',
        reply_markup=approve())
    bot.register_next_step_handler(sent, send_image4)
예제 #2
0
def send_image4(message):
    chat_id = message.chat.id
    if message.text == "Ha":
        new_photo = FourChoice.objects.get(pk=qs[chat_id])
        fileId = new_photo.image
        savol = new_photo.text
        message_id = new_photo.message_id
        bot.send_photo('@mathtest_23',
                       fileId,
                       " {} ".format(savol),
                       reply_markup=option_four_markup(message_id))
        bot.send_message(chat_id, "Tashlandi!", reply_markup=start_buttons())
    if message.text == "Yo\'q":
        query = FourChoice.objects.get(pk=qs[chat_id])
        query.delete()
        bot.send_message(chat_id,
                         "Boshidan boshlang!",
                         reply_markup=start_buttons())
예제 #3
0
def send_Message(message):
    if message.text == 'Savol yaratish':
        sent = bot.send_message(message.chat.id,
                                "Javoblar sonni tanlang!",
                                reply_markup=numb_of_choice())
    elif message.text == "2":
        sent = bot.send_message(message.chat.id,
                                "Savolni kiriting",
                                reply_markup=move_end())
        bot.register_next_step_handler(sent, text2_question)
    elif message.text == "4":
        sent = bot.send_message(message.chat.id,
                                "Savolni kiriting",
                                reply_markup=move_end())
        bot.register_next_step_handler(sent, text4_question)
    else:
        bot.send_message(message.chat.id,
                         'Siz xato so\'zni yubording\'iz qaytadan boshlang!',
                         reply_markup=start_buttons())
예제 #4
0
def start(message):
    hello = "MathLink botiga xushkelibsiz!!!"
    sent = bot.send_message(message.chat.id,
                            hello,
                            reply_markup=start_buttons())