Browse Source

Исправлено множество мелких багов. Шаблон редактирования переведён на шаблон добавления.

test_bot
Alexei 2 years ago
parent
commit
7f360b36b3
  1. 8
      bot_modules/projects.py
  2. 4
      bot_modules/start.py
  3. 8
      bot_modules/tasks.py
  4. 2
      template/bd_item.py
  5. 10
      template/bd_item_add.py
  6. 64
      template/bd_item_edit.py
  7. 16
      template/simple_message.py

8
bot_modules/projects.py

@ -235,14 +235,14 @@ async def ProjectPostDelete(a_CallbackQuery : types.CallbackQuery, a_ItemID):
# --------------------------------------------------------- # ---------------------------------------------------------
# Работа с базой данных проектов # Работа с базой данных проектов
def AddBDItemFunc(a_ItemData): def AddBDItemFunc(a_ItemData, a_UserID):
res, error = bot_bd.SQLRequestToBD(f'INSERT INTO {table_name}({photo_field}, {name_field}, {desc_field}, {access_field}, {create_datetime_field}) VALUES(?, ?, ?, ?, {bot_bd.GetBDDateTimeNow()})', res, error = bot_bd.SQLRequestToBD(f'INSERT INTO {table_name}({photo_field}, {name_field}, {desc_field}, {access_field}, {create_datetime_field}) VALUES(?, ?, ?, ?, {bot_bd.GetBDDateTimeNow()})',
commit = True, return_error = True, param = (a_ItemData[photo_field], a_ItemData[name_field], a_ItemData[desc_field], access.GetItemDefaultAccessForModule(module_name))) commit = True, return_error = True, param = (a_ItemData[photo_field], a_ItemData[name_field], a_ItemData[desc_field], access.GetItemDefaultAccessForModule(module_name) + f";{a_UserID}=+"))
if error: if error:
log.Error(f'Ошибка добавления записи в таблицу {table_name} ({a_ItemData[photo_field]}, {a_ItemData[name_field]}, {a_ItemData[desc_field]}, {access.GetItemDefaultAccessForModule(module_name)}).') log.Error(f'Пользоватлель {a_UserID}. Ошибка добавления записи в таблицу {table_name} ({a_ItemData[photo_field]}, {a_ItemData[name_field]}, {a_ItemData[desc_field]}, {access.GetItemDefaultAccessForModule(module_name)}).')
else: else:
log.Success(f'Добавлена запись в таблицу {table_name} ({a_ItemData[photo_field]}, {a_ItemData[name_field]}, {a_ItemData[desc_field]}, {access.GetItemDefaultAccessForModule(module_name)}).') log.Success(f'Пользоватлель {a_UserID}. Добавлена запись в таблицу {table_name} ({a_ItemData[photo_field]}, {a_ItemData[name_field]}, {a_ItemData[desc_field]}, {access.GetItemDefaultAccessForModule(module_name)}).')
return res, error return res, error

4
bot_modules/start.py

@ -4,7 +4,7 @@
# Стартовое меню # Стартовое меню
from bot_sys import log, config, keyboard, user_access from bot_sys import log, config, keyboard, user_access
from bot_modules import profile, projects, groups, access, backup, tasks from bot_modules import profile, projects, groups, access, backup
from template import simple_message from template import simple_message
from aiogram.dispatcher import Dispatcher from aiogram.dispatcher import Dispatcher
@ -31,7 +31,7 @@ start_menu_button_name = "☰ Главное меню"
# Работа с кнопками # Работа с кнопками
def GetStartKeyboardButtons(a_Message, a_UserGroups): def GetStartKeyboardButtons(a_Message, a_UserGroups):
mods = [profile, projects, groups, access, backup, tasks] mods = [profile, projects, groups, access, backup]
return keyboard.MakeKeyboardForMods(mods, a_UserGroups) return keyboard.MakeKeyboardForMods(mods, a_UserGroups)
# --------------------------------------------------------- # ---------------------------------------------------------

8
bot_modules/tasks.py

@ -234,14 +234,14 @@ async def TaskPostDelete(a_CallbackQuery : types.CallbackQuery, a_ItemID):
# --------------------------------------------------------- # ---------------------------------------------------------
# Работа с базой данных задач # Работа с базой данных задач
def AddBDItemFunc(a_ItemData): def AddBDItemFunc(a_ItemData, a_UserID):
res, error = bot_bd.SQLRequestToBD(f'INSERT INTO {table_name}({photo_field}, {name_field}, {desc_field}, {access_field}, {parent_id_field}, {create_datetime_field}) VALUES(?, ?, ?, ?, ?, {bot_bd.GetBDDateTimeNow()})', res, error = bot_bd.SQLRequestToBD(f'INSERT INTO {table_name}({photo_field}, {name_field}, {desc_field}, {access_field}, {parent_id_field}, {create_datetime_field}) VALUES(?, ?, ?, ?, ?, {bot_bd.GetBDDateTimeNow()})',
commit = True, return_error = True, param = (a_ItemData[photo_field], a_ItemData[name_field], a_ItemData[desc_field], access.GetItemDefaultAccessForModule(module_name), a_ItemData[desc_field])) commit = True, return_error = True, param = (a_ItemData[photo_field], a_ItemData[name_field], a_ItemData[desc_field], access.GetItemDefaultAccessForModule(module_name) + f";{a_UserID}=+", a_ItemData[desc_field]))
if error: if error:
log.Error(f'Ошибка добавления записи в таблицу {table_name} ({a_ItemData[photo_field]}, {a_ItemData[name_field]}, {a_ItemData[desc_field]}, {access.GetItemDefaultAccessForModule(module_name)}).') log.Error(f'Пользоватлель {a_UserID}. Ошибка добавления записи в таблицу {table_name} ({a_ItemData[photo_field]}, {a_ItemData[name_field]}, {a_ItemData[desc_field]}, {access.GetItemDefaultAccessForModule(module_name)}).')
else: else:
log.Success(f'Добавлена запись в таблицу {table_name} ({a_ItemData[photo_field]}, {a_ItemData[name_field]}, {a_ItemData[desc_field]}, {access.GetItemDefaultAccessForModule(module_name)}).') log.Success(f'Пользоватлель {a_UserID}. Добавлена запись в таблицу {table_name} ({a_ItemData[photo_field]}, {a_ItemData[name_field]}, {a_ItemData[desc_field]}, {access.GetItemDefaultAccessForModule(module_name)}).')
return res, error return res, error

2
template/bd_item.py

@ -5,7 +5,7 @@
from enum import Enum from enum import Enum
from bot_sys import user_access, bot_bd, keyboard, log from bot_sys import user_access, bot_bd, keyboard, log
from bot_modules import groups from bot_modules import groups, access
from template import simple_message from template import simple_message
from aiogram import types from aiogram import types

10
template/bd_item_add.py

@ -18,7 +18,7 @@ cancel_message = '''
parent_id_field_name = 'parent_id' parent_id_field_name = 'parent_id'
def StartAddBDItemTemplate(a_FSM, a_FSMStart, a_MessageFunc, a_ParentTableName, a_ParentKeyFieldName, a_Prefix, a_AccessFunc, a_ButtonFunc, a_FinishButtonFunc, access_mode = user_access.AccessMode.EDIT): def StartAddBDItemTemplate(a_FSM, a_FSMStart, a_MessageFunc, a_ParentTableName, a_ParentKeyFieldName, a_Prefix, a_AccessFunc, a_ButtonFunc, a_FinishButtonFunc, access_mode = user_access.AccessMode.ADD):
async def StartAddBDItem(a_CallbackQuery : types.CallbackQuery, state : FSMContext): async def StartAddBDItem(a_CallbackQuery : types.CallbackQuery, state : FSMContext):
user_id = str(a_CallbackQuery.from_user.id) user_id = str(a_CallbackQuery.from_user.id)
user_groups = groups.GetUserGroupData(user_id) user_groups = groups.GetUserGroupData(user_id)
@ -44,8 +44,8 @@ def StartAddBDItemTemplate(a_FSM, a_FSMStart, a_MessageFunc, a_ParentTableName,
return res_of_work_func return res_of_work_func
return simple_message.SimpleMessageTemplate(StartAddBDItem, a_ButtonFunc, a_AccessFunc, access_mode) return simple_message.SimpleMessageTemplate(StartAddBDItem, a_ButtonFunc, a_AccessFunc, access_mode)
def FinishAddBDItemTemplate(a_FSM, a_AddBDItemFunc, a_ParentTableName, a_ParentKeyFieldName, a_FieldName, a_MessageFunc, a_AccessFunc, a_ButtonFunc, a_FinishButtonFunc, access_mode = user_access.AccessMode.ADD, field_type = bd_item.FieldType.text): def FinishAddBDItemTemplate(a_FSM, a_AddBDItemFunc, a_ParentTableName, a_ParentKeyFieldName, a_FieldName, a_MessageFunc, a_AccessFunc, a_ButtonFunc, access_mode = user_access.AccessMode.ADD, field_type = bd_item.FieldType.text):
return FinishOrNextAddBDItemTemplate(a_FSM, a_AddBDItemFunc, a_ParentTableName, a_ParentKeyFieldName, a_FieldName, a_MessageFunc, a_AccessFunc, a_ButtonFunc, a_FinishButtonFunc, True, access_mode = access_mode, field_type = field_type) return FinishOrNextAddBDItemTemplate(a_FSM, a_AddBDItemFunc, a_ParentTableName, a_ParentKeyFieldName, a_FieldName, a_MessageFunc, a_AccessFunc, a_ButtonFunc, a_ButtonFunc, True, access_mode = access_mode, field_type = field_type)
def NextAddBDItemTemplate(a_FSM, a_AddBDItemFunc, a_ParentTableName, a_ParentKeyFieldName, a_FieldName, a_MessageFunc, a_AccessFunc, a_ButtonFunc, a_FinishButtonFunc, access_mode = user_access.AccessMode.ADD, field_type = bd_item.FieldType.text): def NextAddBDItemTemplate(a_FSM, a_AddBDItemFunc, a_ParentTableName, a_ParentKeyFieldName, a_FieldName, a_MessageFunc, a_AccessFunc, a_ButtonFunc, a_FinishButtonFunc, access_mode = user_access.AccessMode.ADD, field_type = bd_item.FieldType.text):
return FinishOrNextAddBDItemTemplate(a_FSM, a_AddBDItemFunc, a_ParentTableName, a_ParentKeyFieldName, a_FieldName, a_MessageFunc, a_AccessFunc, a_ButtonFunc, a_FinishButtonFunc, False, access_mode = access_mode, field_type = field_type) return FinishOrNextAddBDItemTemplate(a_FSM, a_AddBDItemFunc, a_ParentTableName, a_ParentKeyFieldName, a_FieldName, a_MessageFunc, a_AccessFunc, a_ButtonFunc, a_FinishButtonFunc, False, access_mode = access_mode, field_type = field_type)
@ -90,7 +90,7 @@ def FinishOrNextAddBDItemTemplate(a_FSM, a_AddBDItemFunc, a_ParentTableName, a_P
field_value = a_Message.text field_value = a_Message.text
item_data[a_FieldName] = field_value item_data[a_FieldName] = field_value
if a_Finish: if a_Finish:
res, error = a_AddBDItemFunc(item_data) res, error = a_AddBDItemFunc(item_data, user_id)
await state_func() await state_func()
if error: if error:
return simple_message.WorkFuncResult(error) return simple_message.WorkFuncResult(error)
@ -108,4 +108,4 @@ def AddBDItem3RegisterHandlers(dp, a_StartCheckFunc, a_FSM, a_FSMName, a_FSMDesc
dp.register_message_handler(StartAddBDItemTemplate(a_FSM, a_FSMName, a_AddNameMessageFunc, a_ParentTableName, a_ParentKeyFieldName, a_Prefix, a_AccessFunc, keyboard_cancel, a_ButtonFunc, access_mode), a_StartCheckFunc) dp.register_message_handler(StartAddBDItemTemplate(a_FSM, a_FSMName, a_AddNameMessageFunc, a_ParentTableName, a_ParentKeyFieldName, a_Prefix, a_AccessFunc, keyboard_cancel, a_ButtonFunc, access_mode), a_StartCheckFunc)
dp.register_message_handler(NextAddBDItemTemplate(a_FSM, None, a_ParentTableName, a_ParentKeyFieldName, a_NameField, a_AddDescMessageFunc, a_AccessFunc, keyboard_cancel, a_ButtonFunc, access_mode, field_type = bd_item.FieldType.text), state = a_FSMName) dp.register_message_handler(NextAddBDItemTemplate(a_FSM, None, a_ParentTableName, a_ParentKeyFieldName, a_NameField, a_AddDescMessageFunc, a_AccessFunc, keyboard_cancel, a_ButtonFunc, access_mode, field_type = bd_item.FieldType.text), state = a_FSMName)
dp.register_message_handler(NextAddBDItemTemplate(a_FSM, None, a_ParentTableName, a_ParentKeyFieldName, a_DescField, a_AddPhotoMessageFunc, a_AccessFunc, keyboard_skip_and_cancel, a_ButtonFunc, access_mode, field_type = bd_item.FieldType.text), state = a_FSMDesc) dp.register_message_handler(NextAddBDItemTemplate(a_FSM, None, a_ParentTableName, a_ParentKeyFieldName, a_DescField, a_AddPhotoMessageFunc, a_AccessFunc, keyboard_skip_and_cancel, a_ButtonFunc, access_mode, field_type = bd_item.FieldType.text), state = a_FSMDesc)
dp.register_message_handler(FinishAddBDItemTemplate(a_FSM, a_AddBDItemFunc, a_ParentTableName, a_ParentKeyFieldName, a_PhotoField, a_FinishMessageFunc, a_AccessFunc, a_ButtonFunc, a_ButtonFunc, access_mode, field_type = bd_item.FieldType.photo), content_types = ['photo', 'text'], state = a_FSMPhoto) dp.register_message_handler(FinishAddBDItemTemplate(a_FSM, a_AddBDItemFunc, a_ParentTableName, a_ParentKeyFieldName, a_PhotoField, a_FinishMessageFunc, a_AccessFunc, a_ButtonFunc, access_mode, field_type = bd_item.FieldType.photo), content_types = ['photo', 'text'], state = a_FSMPhoto)

64
template/bd_item_edit.py

@ -5,14 +5,12 @@
from bot_sys import user_access, bot_bd, log from bot_sys import user_access, bot_bd, log
from bot_modules import access, groups from bot_modules import access, groups
from template import simple_message, bd_item_select, bd_item from template import simple_message, bd_item_select, bd_item, bd_item_add
from aiogram import types from aiogram import types
from aiogram.dispatcher import FSMContext from aiogram.dispatcher import FSMContext
from aiogram.dispatcher.filters.state import State, StatesGroup from aiogram.dispatcher.filters.state import State, StatesGroup
#TODO: Переделать на FinishOrNextAddBDItemTemplate StartAddBDItemTemplate
cancel_message = ''' cancel_message = '''
🚫 Редактирование отменено 🚫 Редактирование отменено
''' '''
@ -21,66 +19,28 @@ error_photo_type_message = '''
🚫 Фотографий не найдено 🚫 Фотографий не найдено
''' '''
def StartEditBDItemTemplate(a_FSM, a_MessageFunc, a_TableName, a_KeyName, a_FieldName, a_Prefix, a_AccessFunc, a_ButtonFunc, access_mode = user_access.AccessMode.EDIT): def StartEditBDItemTemplate(a_FSM, a_MessageFunc, a_TableName, a_KeyName, a_Prefix, a_AccessFunc, a_ButtonFunc, a_FinishButtonFunc, access_mode = user_access.AccessMode.EDIT):
async def StartEditBDItem(a_CallbackQuery : types.CallbackQuery, state : FSMContext): return bd_item_add.StartAddBDItemTemplate(a_FSM, a_FSM.item_id, a_MessageFunc, a_TableName, a_KeyName, a_Prefix, a_AccessFunc, a_ButtonFunc, a_FinishButtonFunc, access_mode = access_mode)
user_id = str(a_CallbackQuery.from_user.id)
user_groups = groups.GetUserGroupData(user_id)
await a_FSM.item_id.set()
item_id = str(a_CallbackQuery.data).replace(a_Prefix, '')
res_of_work_func = None
async with state.proxy() as item_data:
item_data['item_id'] = item_id
check, res_of_work_func = await bd_item.CheckAccessBDItemTemplate(a_TableName, a_KeyName, item_id, a_MessageFunc, access_mode)(a_CallbackQuery)
if not check is None:
await state.finish()
return check
await a_FSM.next()
return res_of_work_func
return simple_message.SimpleMessageTemplate(StartEditBDItem, a_ButtonFunc, a_AccessFunc, access_mode)
def FinishEditBDItemTemplate(a_FSM, a_TableName, a_KeyName, a_FieldName, a_MessageFunc, a_AccessFunc, a_ButtonFunc, access_mode = user_access.AccessMode.EDIT, field_type = bd_item.FieldType.text): def FinishEditBDItemTemplate(a_FSM, a_TableName, a_KeyName, a_FieldName, a_MessageFunc, a_AccessFunc, a_ButtonFunc, access_mode = user_access.AccessMode.EDIT, field_type = bd_item.FieldType.text):
async def FinishEditBDItem(a_Message : types.CallbackQuery, state : FSMContext): def EditBDItemFunc(a_ItemData, a_UserID):
user_id = str(a_Message.from_user.id) item_id = a_ItemData[bd_item_add.parent_id_field_name]
user_groups = groups.GetUserGroupData(user_id) field_value = a_ItemData[a_FieldName]
error = None
res_of_work_func = None
async with state.proxy() as item_data:
if a_Message.text == bd_item.canсel_button_name:
await state.finish()
return simple_message.WorkFuncResult(cancel_message)
item_id = item_data['item_id']
check, res_of_work_func = await bd_item.CheckAccessBDItemTemplate(a_TableName, a_KeyName, item_id, a_MessageFunc, access_mode)(a_Message)
if not check is None:
await state.finish()
return check
field_value = ''
if field_type == bd_item.FieldType.photo:
if a_Message.photo == None or len(a_Message.photo) == 0:
await state.finish()
return simple_message.WorkFuncResult(error_photo_type_message)
field_value = a_Message.photo[0].file_id
else:
field_value = a_Message.text
res, error = bd_item.EditBDItemInTableTemplate(a_TableName, a_KeyName, a_FieldName)(item_id, field_value) res, error = bd_item.EditBDItemInTableTemplate(a_TableName, a_KeyName, a_FieldName)(item_id, field_value)
log.Success(f'Изменено поле в таблице {a_TableName} ключу {a_KeyName}={item_id}. Новое значение поля {a_FieldName}={field_value}. Пользователь {user_id}.')
await state.finish()
if error: if error:
return simple_message.WorkFuncResult(error) log.Error(f'Пользователю {a_UserID} не удалось изменить поле в таблице {a_TableName} ключу {a_KeyName}={item_id}. Новое значение поля {a_FieldName}={field_value}. Ошибка: {error}')
return res_of_work_func else:
log.Success(f'Пользователь {a_UserID} изменил поле в таблице {a_TableName} ключу {a_KeyName}={item_id}. Новое значение поля {a_FieldName}={field_value}.')
return res, error
return simple_message.SimpleMessageTemplate(FinishEditBDItem, a_ButtonFunc, a_AccessFunc, access_mode) return bd_item_add.FinishAddBDItemTemplate(a_FSM, EditBDItemFunc, a_TableName, a_KeyName, a_FieldName, a_MessageFunc, a_AccessFunc, a_ButtonFunc, access_mode = access_mode, field_type = field_type)
def EditBDItemRegisterHandlers(dp, a_FSM, a_ButtonName, a_StartMessage, a_EditMessageFunc, a_FinishMessageFunc, a_TableName : str, a_KeyName, a_FieldName, a_GetButtonNameAndKeyValueAndAccessFunc, a_AccessFunc, a_ButtonFunc, access_mode = user_access.AccessMode.EDIT, field_type = bd_item.FieldType.text): def EditBDItemRegisterHandlers(dp, a_FSM, a_ButtonName, a_StartMessage, a_EditMessageFunc, a_FinishMessageFunc, a_TableName : str, a_KeyName, a_FieldName, a_GetButtonNameAndKeyValueAndAccessFunc, a_AccessFunc, a_ButtonFunc, access_mode = user_access.AccessMode.EDIT, field_type = bd_item.FieldType.text):
keyboard_cancel = bd_item.GetCancelKeyboardButtonsTemplate(a_AccessFunc, access_mode) keyboard_cancel = bd_item.GetCancelKeyboardButtonsTemplate(a_AccessFunc, access_mode)
a_Prefix = f'edit_{a_TableName}_{a_KeyName}_{a_FieldName}:' a_Prefix = f'edit_{a_TableName}_{a_KeyName}_{a_FieldName}:'
sel_handler = bd_item_select.SelectDBItemTemplate(a_TableName, None, a_GetButtonNameAndKeyValueAndAccessFunc, a_StartMessage, a_AccessFunc, None, a_Prefix, access_mode) sel_handler = bd_item_select.SelectDBItemTemplate(a_TableName, None, a_GetButtonNameAndKeyValueAndAccessFunc, a_StartMessage, a_AccessFunc, None, a_Prefix, access_mode)
dp.register_message_handler(sel_handler, text = a_ButtonName) dp.register_message_handler(sel_handler, text = a_ButtonName)
dp.register_callback_query_handler(StartEditBDItemTemplate(a_FSM, a_EditMessageFunc, a_TableName, a_KeyName, a_FieldName, a_Prefix, a_AccessFunc, keyboard_cancel, access_mode), bd_item.GetCheckForPrefixFunc(a_Prefix)) dp.register_callback_query_handler(StartEditBDItemTemplate(a_FSM, a_EditMessageFunc, a_TableName, a_KeyName, a_Prefix, a_AccessFunc, keyboard_cancel, a_ButtonFunc, access_mode), bd_item.GetCheckForPrefixFunc(a_Prefix))
if field_type == bd_item.FieldType.photo: if field_type == bd_item.FieldType.photo:
dp.register_message_handler(FinishEditBDItemTemplate(a_FSM, a_TableName, a_KeyName, a_FieldName, a_FinishMessageFunc, a_AccessFunc, a_ButtonFunc, access_mode, field_type = field_type), content_types = ['photo', 'text'], state = a_FSM.item_field) dp.register_message_handler(FinishEditBDItemTemplate(a_FSM, a_TableName, a_KeyName, a_FieldName, a_FinishMessageFunc, a_AccessFunc, a_ButtonFunc, access_mode, field_type = field_type), content_types = ['photo', 'text'], state = a_FSM.item_field)
else: else:

16
template/simple_message.py

@ -11,11 +11,11 @@ from aiogram import Bot
bot = Bot(token=config.GetTelegramBotApiToken(), parse_mode = types.ParseMode.HTML) bot = Bot(token=config.GetTelegramBotApiToken(), parse_mode = types.ParseMode.HTML)
class WorkFuncResult(): class WorkFuncResult():
def __init__(self, a_StringMessage : str, photo_id = None, item_access = None, keyborad_func = None): def __init__(self, a_StringMessage : str, photo_id = None, item_access = None, keyboard_func = None):
self.string_message = a_StringMessage self.string_message = a_StringMessage
self.photo_id = photo_id self.photo_id = photo_id
self.item_access = item_access self.item_access = item_access
self.keyborad_func = keyborad_func self.keyboard_func = keyboard_func
def InfoMessageTemplate(a_HelpMessage, a_GetButtonsFunc, a_AccessFunc, access_mode = user_access.AccessMode.VIEW): def InfoMessageTemplate(a_HelpMessage, a_GetButtonsFunc, a_AccessFunc, access_mode = user_access.AccessMode.VIEW):
@ -35,9 +35,9 @@ def SimpleMessageTemplate(a_WorkFunc, a_GetButtonsFunc, a_AccessFunc, access_mod
if res is None: if res is None:
return return
keyborad_func = a_GetButtonsFunc keyboard_func = a_GetButtonsFunc
if res.keyborad_func: if res.keyboard_func:
keyborad_func = res.keyborad_func keyboard_func = res.keyboard_func
msg = res.string_message msg = res.string_message
if msg is None: if msg is None:
@ -46,10 +46,10 @@ def SimpleMessageTemplate(a_WorkFunc, a_GetButtonsFunc, a_AccessFunc, access_mod
photo_id = res.photo_id photo_id = res.photo_id
if not res.item_access is None and not user_access.CheckAccessString(res.item_access, user_groups, access_mode): if not res.item_access is None and not user_access.CheckAccessString(res.item_access, user_groups, access_mode):
return await bot.send_message(a_Message.from_user.id, access.access_denied_message, reply_markup = keyborad_func(a_Message, user_groups)) return await bot.send_message(a_Message.from_user.id, access.access_denied_message, reply_markup = keyboard_func(a_Message, user_groups))
if photo_id is None or photo_id == 0 or photo_id == '0': if photo_id is None or photo_id == 0 or photo_id == '0':
return await bot.send_message(a_Message.from_user.id, msg, reply_markup = keyborad_func(a_Message, user_groups)) return await bot.send_message(a_Message.from_user.id, msg, reply_markup = keyboard_func(a_Message, user_groups))
await bot.send_photo(user_id, photo_id, msg, reply_markup = keyborad_func(a_Message, user_groups)) await bot.send_photo(user_id, photo_id, msg, reply_markup = keyboard_func(a_Message, user_groups))
return SimpleMessage return SimpleMessage

Loading…
Cancel
Save