Fixed bugs in parser decorator

This commit is contained in:
Davte 2019-07-15 15:02:11 +02:00
parent 4c25c935bb
commit 052410ecf7

View File

@ -611,7 +611,7 @@ class Bot(TelegramBot, ObjectWithDatabase):
parser['argument'] == 'update' parser['argument'] == 'update'
and check_function(update) and check_function(update)
): ):
replier = parser['function'] replier = parser['handler']
break break
if replier: if replier:
reply = await replier( reply = await replier(
@ -1362,20 +1362,20 @@ class Bot(TelegramBot, ObjectWithDatabase):
) )
def parser_decorator(parser): def parser_decorator(parser):
async def decorated_parser(bot, message, user_record): async def decorated_parser(bot, update, user_record):
logging.info( logging.info(
f"Text message update matching condition " f"Text message update matching condition "
f"`{condition.__name__}@{bot.name}` from " f"`{condition.__name__}@{bot.name}` from "
"`{user}`".format( "`{user}`".format(
user=( user=(
message['from'] update['from']
if 'from' in message if 'from' in update
else message['chat'] else update['chat']
) )
) )
) )
if bot.authorization_function( if bot.authorization_function(
update=message, update=update,
user_record=user_record, user_record=user_record,
authorization_level=authorization_level authorization_level=authorization_level
): ):