From 0a44bae31764fa246a88d6184717350f3a2f7090 Mon Sep 17 00:00:00 2001 From: Alexei Date: Sun, 14 May 2023 14:40:36 +0300 Subject: [PATCH] =?UTF-8?q?=D0=93=D1=80=D1=83=D0=BF=D0=BF=D1=8B=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=BB=D0=BD=D0=BE=D1=81=D1=82=D1=8C=D1=8E=20=D1=80=D0=B0?= =?UTF-8?q?=D0=B1=D0=BE=D1=82=D0=B0=D1=8E=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- template/sql_request.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/template/sql_request.py b/template/sql_request.py index cab7580..f50696b 100644 --- a/template/sql_request.py +++ b/template/sql_request.py @@ -3,7 +3,7 @@ # Сообщения для работы с sql запросами -from bot_sys import user_access, keyboard +from bot_sys import user_access, keyboard, bot_messages from bot_modules import groups_utils from template import bd_item, simple_message @@ -20,6 +20,7 @@ def GetCancelKeyboardButtonsTemplate(a_AccessFunc, a_AccessMode): keyboard.ButtonWithAccess(canсel_button_name, a_AccessMode, a_AccessFunc()) ] return keyboard.MakeButtons(cur_buttons, a_UserGroups) + return GetCancelKeyboardButtons # TODO CheckAccessString -> CheckAccess @@ -38,7 +39,7 @@ def RequestToBDTemplate(a_Bot, a_StartMessage, a_GetButtonsFunc, a_AccessFunc, a def RequestToBDFinishTemplate(a_Bot, a_GetButtonsFunc, a_AccessFunc, a_AccessMode): async def RequestToBDFinish(a_Message, state): user_id = str(a_Message.from_user.id) - user_groups = groups.GetUserGroupData(a_Bot, user_id) + user_groups = groups_utils.GetUserGroupData(a_Bot, user_id) if not user_access.CheckAccessString(a_AccessFunc(), user_groups, a_AccessMode): return await simple_message.AccessDeniedMessage(a_Bot, a_GetButtonsFunc, user_id, a_Message, user_groups) @@ -46,18 +47,18 @@ def RequestToBDFinishTemplate(a_Bot, a_GetButtonsFunc, a_AccessFunc, a_AccessMod async with state.proxy() as prjData: if a_Message.text == canсel_button_name: await state.finish() - return await simple_message.SendMessage(a_Bot, keyboard.MakeBotMessage(cancel_message), a_GetButtonsFunc, None, user_id, a_Message, user_groups) + return await simple_message.SendMessage(a_Bot, bot_messages.MakeBotMessage(cancel_message), a_GetButtonsFunc, None, user_id, a_Message, user_groups) sql_request = a_Message.text a_Bot.GetLog().Success(f'Сделан запрос [{sql_request}] пользователем {a_Message.from_user.id}.') - result, error = a_Bot.SQLReques(sql_request, commit = True, return_error = True) + result, error = a_Bot.SQLRequest(sql_request, commit = True, return_error = True) if not error is None: a_Bot.GetLog().Error(f'Ошибка при выполнении запроса [{sql_request}] от пользователя {a_Message.from_user.id} ответ следующий [{str(error)}].') result = str(error) else: a_Bot.GetLog().Success(f'Результат запроса [{sql_request}] от пользователя {a_Message.from_user.id} следующий [{result}].') await state.finish() - await simple_message.SendMessage(a_Bot, keyboard.MakeBotMessage(str(result)), a_GetButtonsFunc, None, user_id, a_Message, user_groups) + await simple_message.SendMessage(a_Bot, bot_messages.MakeBotMessage(str(result)), a_GetButtonsFunc, None, user_id, a_Message, user_groups) return RequestToBDFinish