# Если пользователь не состоит ни в одной группе, то добавляем его в группу user_access.user_access_group_new
iflen(user_groups.group_names_list)==0:
new_group_id=a_Bot.SQLRequest(f'SELECT {groups.key_table_groups_name} FROM {groups.table_groups_name} WHERE {groups.name_table_groups_field} = ?',
new_group_id=a_Bot.SQLRequest(f'SELECT {users_groups_agregator.key_table_groups_name} FROM {users_groups_agregator.table_groups_name} WHERE {users_groups_agregator.name_table_groups_field} = ?',
param=[user_access.user_access_group_new])
ifnew_group_idandnew_group_id[0]:
a_Bot.SQLRequest(f"INSERT OR IGNORE INTO {groups.table_user_in_groups_name} ({groups.user_id_field}, {groups.key_table_groups_name}, {groups.access_field}, {groups.create_datetime_field}) VALUES (?, ?, ?, {bot_bd.GetBDDateTimeNow()});",
a_Bot.SQLRequest(f"INSERT OR IGNORE INTO {users_groups_agregator.table_user_in_groups_name} ({users_groups_agregator.user_id_field}, {users_groups_agregator.key_table_groups_name}, {users_groups_agregator.access_field}, {users_groups_agregator.create_datetime_field}) VALUES (?, ?, ?, {bot_bd.GetBDDateTimeNow()});",