def bnts_users(gpid, id):
    users = requestsApi.getusers_in_group(gpid)
    btns = []
    btns.append(
        ("Образование", "baseusereducation_" + str(users[id]['telegram_id']) +
         "_" + str(id) + "_" + str(gpid)))
    btns.append(
        ("Проекты", "baseuserprojects_" + str(users[id]['telegram_id']) + "_" +
         str(id) + "_" + str(gpid)))
    btns.append(("Работа", "baseuserwork_" + str(users[id]['telegram_id']) +
                 "_" + str(id) + "_" + str(gpid)))
    if len(users) == 1:
        btns.append(("На главную", "tomain"))
    elif len(users) > 1 and id == 0:
        btns.append(("Вперед", "gonext_" + str(gpid) + "_" + str(id + 1)))
        btns.append(("На главную", "tomain"))
    elif len(users) != (id + 1):
        btns.append(("Вперед", "gonext_" + str(gpid) + "_" + str(id + 1)))
        btns.append(("Назад", "goback_" + str(gpid) + "_" + str(id - 1)))
        btns.append(("На главную", "tomain"))
    elif len(users) == (id + 1):
        btns.append(("Назад", "goback_" + str(gpid) + "_" + str(id - 1)))
        btns.append(("На главную", "tomain"))
    finish_btns = tg_helper.create_inline_markup(*btns, row_width=2)
    return finish_btns
async def goback(callback_query: types.CallbackQuery):
    gpid = str(callback_query.data).split("_")[1]
    idinbd = int(str(callback_query.data).split("_")[2])
    urs = requestsApi.getusers_in_group(gpid)
    if urs:
        photo_id = get_photo_id(urs[idinbd]['telegram_id'])
        data = main_data(urs[idinbd]['telegram_id'])
        if photo_id:
            await bot.send_photo(chat_id=callback_query.from_user.id,
                                 photo=photo_id,
                                 caption=data,
                                 reply_markup=bnts_users(gpid, idinbd))
    else:
        await bot.send_message(callback_query.from_user.id, groups_empty)
async def backtouser(callback_query: types.CallbackQuery):
    gpid = str(callback_query.data).split("_")[3]
    id = int(str(callback_query.data).split("_")[2])
    tgid = int(str(callback_query.data).split("_")[1])
    urs = requestsApi.getusers_in_group(gpid)
    if urs:
        photo_id = get_photo_id(tgid)
        data = main_data(tgid)
        if photo_id:
            await bot.edit_message_caption(
                chat_id=callback_query.from_user.id,
                message_id=callback_query.message.message_id,
                caption=data,
                reply_markup=bnts_users(gpid, id))
    else:
        await bot.send_message(callback_query.from_user.id, groups_empty)
async def city(callback_query: types.CallbackQuery):
    selected_fond = str(callback_query.data).split("_")[1]
    year_fond = str(callback_query.data).split("_")[2]
    groups = requestsApi.getgroups()
    gpid = ''
    for i in range(0, len(groups)):
        fond = groups[i]['fond']
        if fond == selected_fond and year_fond == groups[i]['year']:
            gpid = groups[i]['group_id']
    urs = requestsApi.getusers_in_group(gpid)
    if urs:
        photo_id = get_photo_id(urs[0]['telegram_id'])
        data = main_data(urs[0]['telegram_id'])
        if photo_id:
            await bot.send_photo(chat_id=callback_query.from_user.id,
                                 photo=photo_id,
                                 caption=data,
                                 reply_markup=bnts_users(gpid, 0))
    else:
        await bot.send_message(callback_query.from_user.id, groups_empty)