custom_parser does not exist anymore

This commit is contained in:
Davte 2019-07-19 16:45:32 +02:00
parent 6075e5513b
commit 3c12b00839
2 changed files with 10 additions and 18 deletions

View File

@ -144,7 +144,7 @@ async def _forward_to(update, bot, sender, addressee, is_admin=False):
admin_record=admin_record admin_record=admin_record
) )
else: else:
bot.set_custom_parser( bot.set_individual_text_message_handler(
await async_wrapper( await async_wrapper(
_forward_to, _forward_to,
bot=bot, bot=bot,
@ -358,7 +358,7 @@ async def start_session(bot, user_record, admin_record):
] ]
) )
) )
bot.set_custom_parser( bot.set_individual_text_message_handler(
await async_wrapper( await async_wrapper(
_forward_to, _forward_to,
bot=bot, bot=bot,
@ -368,7 +368,7 @@ async def start_session(bot, user_record, admin_record):
), ),
user_record['telegram_id'] user_record['telegram_id']
) )
bot.set_custom_parser( bot.set_individual_text_message_handler(
await async_wrapper( await async_wrapper(
_forward_to, _forward_to,
bot=bot, bot=bot,
@ -413,9 +413,7 @@ async def end_session(bot, user_record, admin_record):
), ),
) )
for record in (admin_record, user_record, ): for record in (admin_record, user_record, ):
telegram_id = record['telegram_id'] bot.remove_individual_text_message_handler(record['telegram_id'])
if telegram_id in bot.custom_parsers:
del bot.custom_parsers[telegram_id]
return return
@ -424,7 +422,7 @@ async def _talk_button(update, bot):
command, *arguments = extract(update['data'], '///').split('|') command, *arguments = extract(update['data'], '///').split('|')
result, text, reply_markup = '', '', None result, text, reply_markup = '', '', None
if command == 'search': if command == 'search':
bot.set_custom_parser( bot.set_individual_text_message_handler(
await async_wrapper( await async_wrapper(
_talk_command, _talk_command,
bot=bot bot=bot

View File

@ -139,10 +139,9 @@ async def _forward_to(update, bot, sender, addressee, is_admin=False):
admin_record=admin_record admin_record=admin_record
) )
else: else:
bot.set_custom_parser( bot.set_individual_text_message_handler(
await async_wrapper( await async_wrapper(
_forward_to, _forward_to,
bot=bot,
sender=sender, sender=sender,
addressee=addressee, addressee=addressee,
is_admin=is_admin is_admin=is_admin
@ -353,20 +352,18 @@ async def start_session(bot, user_record, admin_record):
] ]
) )
) )
bot.set_custom_parser( bot.set_individual_text_message_handler(
await async_wrapper( await async_wrapper(
_forward_to, _forward_to,
bot=bot,
sender=user_record['telegram_id'], sender=user_record['telegram_id'],
addressee=admin_record['telegram_id'], addressee=admin_record['telegram_id'],
is_admin=False is_admin=False
), ),
user_record['telegram_id'] user_record['telegram_id']
) )
bot.set_custom_parser( bot.set_individual_text_message_handler(
await async_wrapper( await async_wrapper(
_forward_to, _forward_to,
bot=bot,
sender=admin_record['telegram_id'], sender=admin_record['telegram_id'],
addressee=user_record['telegram_id'], addressee=user_record['telegram_id'],
is_admin=True is_admin=True
@ -408,9 +405,7 @@ async def end_session(bot, user_record, admin_record):
), ),
) )
for record in (admin_record, user_record, ): for record in (admin_record, user_record, ):
telegram_id = record['telegram_id'] bot.remove_individual_text_message_handler(record['telegram_id'])
if telegram_id in bot.custom_parsers:
del bot.custom_parsers[telegram_id]
return return
@ -419,10 +414,9 @@ async def _talk_button(update, bot):
command, *arguments = extract(update['data'], '///').split('|') command, *arguments = extract(update['data'], '///').split('|')
result, text, reply_markup = '', '', None result, text, reply_markup = '', '', None
if command == 'search': if command == 'search':
bot.set_custom_parser( bot.set_individual_text_message_handler(
await async_wrapper( await async_wrapper(
_talk_command, _talk_command,
bot=bot
), ),
update update
) )