Skip to content

Commit

Permalink
Merge pull request #335 from sysblok/dev
Browse files Browse the repository at this point in the history
fix: TelegramError handling, db_fetch_all_team_members cmd
  • Loading branch information
alexeyqu authored Oct 30, 2024
2 parents d9a82d3 + b378125 commit bd1ae57
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,11 @@ def init_handlers(self):
"db_fetch_strings_sheet",
self.admin_reply_handler("db_fetch_strings_sheet_job"),
)
self.add_handler(
self.add_admin_handler(
"db_fetch_all_team_members",
CommandCategories.DATA_SYNC,
self.admin_reply_handler("db_fetch_all_team_members_job"),
"db_fetch_all_team_members",
)

# general purpose cmds
Expand Down
6 changes: 3 additions & 3 deletions src/tg/sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def send_to_chat_id(self, message_text: str, chat_id: int, **kwargs) -> bool:
)
)
return True
except telegram.TelegramError as e:
except telegram.error.TelegramError as e:
logger.error(f"Could not send a message to {chat_id}: {e}")

username = self.bot.get_chat(chat_id).username
Expand All @@ -109,7 +109,7 @@ def send_to_chat_id(self, message_text: str, chat_id: int, **kwargs) -> bool:
**kwargs,
),
)
except telegram.TelegramError as e:
except telegram.error.TelegramError as e:
logger.error(
"Could not redirect unsended message "
f"to error_logs_recipients {error_logs_recipient}: {e}"
Expand All @@ -131,7 +131,7 @@ def send_to_chat_id(self, message_text: str, chat_id: int, **kwargs) -> bool:
),
)
return True
except telegram.TelegramError as e:
except telegram.error.TelegramError as e:
logger.error(
f"Could not send a plain-text message to {chat_id}: {e}"
)
Expand Down

0 comments on commit bd1ae57

Please sign in to comment.