Skip to content
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

fix: TelegramError handling, db_fetch_all_team_members cmd #335

Merged
merged 2 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading