def lnk(c): bot.delete_message(chat_id=c.message.chat.id, message_id=c.message.message_id) db_vote_set(c.from_user.id, db_vote_get(c.from_user.id) - 5) bot.send_message(c.message.chat.id, "*ID:" + str(c.from_user.id) + " Profile*" + "\n" + "Vote points: " + str(db_vote_get(c.from_user.id)) + "\n" + constants.LIKE_DISLIKE + str(db_value_get(c.from_user.id, "like")) + "|" + str(db_value_get(c.from_user.id, "dislike")), parse_mode="Markdown", reply_markup=prof_keyboard())
def del_actions(c): if c.data == 'del_to_prof': bot.delete_message(chat_id=c.message.chat.id, message_id=c.message.message_id) bot.send_message(c.message.chat.id, "*ID:" + str(c.from_user.id) + " Profile*" + "\n" + "Vote points: " + str(db_vote_get(c.from_user.id)) + "\n" + constants.LIKE_DISLIKE + str(db_value_get(c.from_user.id, "like")) + "|" + str(db_value_get(c.from_user.id, "dislike")), parse_mode="Markdown", reply_markup=prof_keyboard()) elif c.data == 'delete_photo1': db_ph_set(c.from_user.id, 1, "None") bot.delete_message(chat_id=c.message.chat.id, message_id=c.message.message_id) bot.send_message(c.message.chat.id, "*ID:" + str(c.from_user.id) + " Profile*" + "\n" + "Vote points: " + str(db_vote_get(c.from_user.id)) + "\n" + constants.LIKE_DISLIKE + str(db_value_get(c.from_user.id, "like")) + "|" + str(db_value_get(c.from_user.id, "dislike")), parse_mode="Markdown", reply_markup=prof_keyboard()) elif c.data == 'delete_photo2': db_ph_set(c.from_user.id, 2, "None") bot.delete_message(chat_id=c.message.chat.id, message_id=c.message.message_id) bot.send_message(c.message.chat.id, "*ID:" + str(c.from_user.id) + " Profile*" + "\n" + "Vote points: " + str(db_vote_get(c.from_user.id)) + "\n" + constants.LIKE_DISLIKE + str(db_value_get(c.from_user.id, "like")) + "|" + str(db_value_get(c.from_user.id, "dislike")), parse_mode="Markdown", reply_markup=prof_keyboard()) elif c.data == 'delete_photo3': db_ph_set(c.from_user.id, 3, "None") bot.delete_message(chat_id=c.message.chat.id, message_id=c.message.message_id) bot.send_message(c.message.chat.id, "*ID:" + str(c.from_user.id) + " Profile*" + "\n" + "Vote points: " + str(db_vote_get(c.from_user.id)) + "\n" + constants.LIKE_DISLIKE + str(db_value_get(c.from_user.id, "like")) + "|" + str(db_value_get(c.from_user.id, "dislike")), parse_mode="Markdown", reply_markup=prof_keyboard())
def callback_like(c): bot.delete_message(chat_id=c.message.chat.id, message_id=c.message.message_id) db_vote_set(c.from_user.id, db_vote_get(c.from_user.id) + 1) nowid = int(c.data[-9:]) db_like_set(nowid, db_like_get(nowid) + 1) cvlst = db_value_get(c.from_user.id, "votedlist") if cvlst is not None: # Get current votedlist db_value_set(c.from_user.id, "votedlist", cvlst + str(nowid) + '\n') else: db_value_set(c.from_user.id, "votedlist", str(nowid) + '\n') bot.send_chat_action(c.from_user.id, 'upload_photo') currID = db_vote_not_voted_get(c.from_user.id) if currID is None: bot.send_message(c.from_user.id, constants.NO_NEW_PHOTOS) return usrrand = db_rand_get(c.from_user.id) idtovote = db_ph_get(currID, usrrand) bot.send_photo(c.message.chat.id, idtovote, reply_markup=pages_keyboard(currID))
def profile_actions(c): # Close Profile by deleting message with it if c.data == 'p_close': bot.delete_message(chat_id=c.message.chat.id, message_id=c.message.message_id) bot.send_message(c.message.chat.id, constants.INFO_CLOSED) # DELETE OPTION elif c.data == 'p_del': bot.delete_message(chat_id=c.message.chat.id, message_id=c.message.message_id) bot.send_message(c.message.chat.id, constants.DEL_SELECT, reply_markup=del_keyboard()) elif c.data == 'p_del_1': bot.delete_message(chat_id=c.message.chat.id, message_id=c.message.message_id) sphoto = db_ph_get(c.from_user.id, 1) has = 1 if sphoto == constants.DB_EMPTY_STR: has = 0 sphoto = constants.NO_PHOTO_1_ID # NONE 1 PHOTO bot.send_photo(c.from_user.id, sphoto, reply_markup=del_page_keyboard(1, has)) elif c.data == 'p_del_2': bot.delete_message(chat_id=c.message.chat.id, message_id=c.message.message_id) sphoto = db_ph_get(c.from_user.id, 2) has = 1 if sphoto == constants.DB_EMPTY_STR: has = 0 sphoto = constants.NO_PHOTO_2_ID # NONE 2 PHOTO bot.send_photo(c.from_user.id, sphoto, reply_markup=del_page_keyboard(2, has)) elif c.data == 'p_del_3': bot.delete_message(chat_id=c.message.chat.id, message_id=c.message.message_id) sphoto = db_ph_get(c.from_user.id, 3) has = 1 if sphoto == constants.DB_EMPTY_STR: has = 0 sphoto = constants.NO_PHOTO_3_ID # NONE 3 PHOTO bot.send_photo(c.from_user.id, sphoto, reply_markup=del_page_keyboard(3, has)) elif c.data == 'p_my': bot.delete_message(chat_id=c.message.chat.id, message_id=c.message.message_id) bot.send_message(c.message.chat.id, constants.DEL_SELECT, reply_markup=my_keyboard()) elif c.data == 'p_my_1': bot.delete_message(chat_id=c.message.chat.id, message_id=c.message.message_id) sphoto = db_ph_get(c.from_user.id, 1) has = 1 if sphoto == constants.DB_EMPTY_STR: has = 0 sphoto = constants.NO_PHOTO_1_ID # NONE 1 PHOTO bot.send_photo(c.from_user.id, sphoto, reply_markup=my_page_keyboard()) elif c.data == 'p_my_2': bot.delete_message(chat_id=c.message.chat.id, message_id=c.message.message_id) sphoto = db_ph_get(c.from_user.id, 2) has = 1 if sphoto == constants.DB_EMPTY_STR: has = 0 sphoto = constants.NO_PHOTO_2_ID # NONE 2 PHOTO bot.send_photo(c.from_user.id, sphoto, reply_markup=my_page_keyboard()) elif c.data == 'p_my_3': bot.delete_message(chat_id=c.message.chat.id, message_id=c.message.message_id) sphoto = db_ph_get(c.from_user.id, 3) has = 1 if sphoto == constants.DB_EMPTY_STR: has = 0 sphoto = constants.NO_PHOTO_3_ID # NONE 3 PHOTO bot.send_photo(c.from_user.id, sphoto, reply_markup=my_page_keyboard()) elif c.data == 'p_to_my': bot.delete_message(chat_id=c.message.chat.id, message_id=c.message.message_id) bot.send_message(c.message.chat.id, "*ID:" + str(c.from_user.id) + " Profile*" + "\n" + "Vote points: " + str(db_vote_get(c.from_user.id)) + "\n" + constants.LIKE_DISLIKE + str(db_value_get(c.from_user.id, "like")) + "|" + str(db_value_get(c.from_user.id, "dislike")), parse_mode="Markdown", reply_markup=prof_keyboard())
def stop(c): bot.delete_message(chat_id=c.message.chat.id, message_id=c.message.message_id) bot.send_message(c.message.chat.id, constants.INFO_STOPPED)
def upload(c): bot.delete_message(chat_id=c.message.chat.id, message_id=c.message.message_id)