-
Notifications
You must be signed in to change notification settings - Fork 3
Ahora el "en camino" de /dafi lo envía a los interesados #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -109,7 +109,7 @@ def cmd_dafi(update: Update, context: CallbackContext[dict, dict, dict]) -> None | |
| context.bot_data['room_queue'] = queue | ||
|
|
||
| if action == RoomActions.ON: | ||
| if user.telegram_id in members: | ||
| if user.telegram_id in members_ids: | ||
| update.effective_message.reply_text( | ||
| 'Ya tenía constancia de que estás en DAFI ⚠️' | ||
| ) | ||
|
|
@@ -195,26 +195,28 @@ def callback_dafi(update: Update, context: CallbackContext[dict, dict, dict]) -> | |
| members = list(User.objects.filter(telegram_id__in=members_ids)) | ||
|
|
||
| if action == 'omw': | ||
| failed_messages = 0 | ||
| if not members: | ||
| query.edit_message_text( | ||
| 'Ahora mismo no hay nadie en DAFI 😓' | ||
| ) | ||
| return | ||
|
|
||
| group_id = Config.get(Config.MAIN_GROUP_ID) | ||
|
|
||
| try: | ||
| assert group_id is not None | ||
|
|
||
| context.bot.send_message( | ||
| group_id, | ||
| f'¡{update.effective_user.name} está de camino a DAFI!', | ||
| ) | ||
| except (TelegramError, AssertionError): | ||
| for member_id in members_ids: | ||
| try: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cuidado con los espacios en blanco al final de una línea. Para ir rápido: https://stackoverflow.com/a/30884298 |
||
| context.bot.send_message( | ||
| member_id, | ||
| f'¡{update.effective_user.name} está de camino a DAFI!', | ||
| ) | ||
|
|
||
| except: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No olvides utilizar las excepciones correctas en el |
||
| failed_messages += 1 | ||
| return | ||
|
|
||
| if failed_messages > 0: | ||
| update.effective_message.reply_text( | ||
| 'No he podido avisarles 😓' | ||
| ) | ||
| return | ||
| 'No he podido avisarles 😓' | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cuidado con la indentación, recuerda que tenemos que seguir PEP 8. Para ir rápido: https://flake8.pycqa.org/en/latest/ |
||
| ) | ||
|
|
||
| query.edit_message_reply_markup() # To remove the button | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.