def show_goals(message): db = DbHandler() keyboard_goals = keyboards.goals_keyboard() records = db.select_goals(message.chat.id) if len(records) > 0: to_print = 'Your goals:\n' i = 1 for record in records: to_print += str(i) + '. ' if record[3] == 1: to_print += '~' + record[2] + '~\n' else: to_print += record[2] + "\n" db.add_gener_num_goals(record[0], i) i += 1 to_print = functions.markdownv2_ecran(to_print) bot.send_message(message.chat.id, to_print, reply_markup=keyboard_goals, parse_mode="MarkdownV2") else: kb_goals = Keyboa(items=[{'add new goal':'new_goal'}]).keyboard bot.send_message(message.chat.id, "You don't have any goals yet", reply_markup=kb_goals)
def create_list(user_id, function): if function == 'habits': db = DbHandler() records = db.select_habits(user_id) elif function == 'goals': db = DbHandler() records = db.select_goals(user_id) if len(records) > 0: to_print1 = f'Your {function}:\n' i = 1 for record in records: to_print1 += str(i) + '\. ' if record[4] == 1: to_print1 += '~' + record[2] + '~\n' else: to_print1 += record[2] + "\n" db.add_gener_num_habits(record[0], i) i += 1 else: to_print1 = None return to_print1