Minor bugs fixed in suggestions module

This commit is contained in:
Davte 2020-02-17 12:22:42 +01:00
parent f17333ca42
commit 61ea563bfa
2 changed files with 10 additions and 4 deletions

View File

@ -14,7 +14,7 @@ __author__ = "Davide Testa"
__email__ = "davide@davte.it" __email__ = "davide@davte.it"
__credits__ = ["Marco Origlia", "Nick Lee @Nickoala"] __credits__ = ["Marco Origlia", "Nick Lee @Nickoala"]
__license__ = "GNU General Public License v3.0" __license__ = "GNU General Public License v3.0"
__version__ = "2.4.0" __version__ = "2.4.1"
__maintainer__ = "Davide Testa" __maintainer__ = "Davide Testa"
__contact__ = "t.me/davte" __contact__ = "t.me/davte"

View File

@ -55,7 +55,11 @@ async def _handle_suggestion_message(bot: davtelepot.bot.Bot, update, user_recor
'suggestions', 'suggestions_command', 'invalid_suggestion', 'suggestions', 'suggestions_command', 'invalid_suggestion',
update=update, user_record=user_record update=update, user_record=user_record
) )
if text.lower() in bot.messages['suggestions']['suggestions_command']['cancel_messages']: if text.lower() in [
cancel_message
for language in bot.messages['suggestions']['suggestions_command']['cancel_messages'].values()
for cancel_message in language
]:
return bot.get_message( return bot.get_message(
'suggestions', 'suggestions_command', 'operation_cancelled', 'suggestions', 'suggestions_command', 'operation_cancelled',
update=update, user_record=user_record update=update, user_record=user_record
@ -135,8 +139,10 @@ async def _suggestions_button(bot: davtelepot.bot.Bot, update, user_record, data
update=update, user_record=user_record update=update, user_record=user_record
) )
elif command in ['cancel']: elif command in ['cancel']:
result = 'Operazione annullata' result = text = bot.get_message(
text = 'Operazione annullata con successo.' 'suggestions', 'suggestions_command', 'operation_cancelled',
update=update, user_record=user_record
)
reply_markup = None reply_markup = None
elif command in ['confirm'] and len(data) > 1: elif command in ['confirm'] and len(data) > 1:
suggestion_id = data[1] suggestion_id = data[1]