Skip to content

Commit

Permalink
fix mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
louisevelayo committed Dec 1, 2023
1 parent 6e85ad6 commit dc6a8b7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions node_monitor/bot_slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ def send_message(


def send_messages(
self, slack_channel_names: List[str],
self, slack_channel_names: List[str], subject: str,
message: str) -> None | SlackApiError:
"""Send a message to multiple Slack channels."""
# Propagate the last error that occurs
err = None
for slack_channel_name in slack_channel_names:
this_err = self.send_message(slack_channel_name, message)
this_err = self.send_message(slack_channel_name, subject, message)
if this_err is not None:
err = this_err
return err
4 changes: 2 additions & 2 deletions node_monitor/bot_telegram.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ def send_message(


def send_messages(
self, chat_ids: List[str], message: str
self, chat_ids: List[str], subject: str, message: str
) -> None | requests.exceptions.HTTPError:
"""Send a message to multiple Telegram chats."""
# Propagate the last error that occurs
err = None
for chat_id in chat_ids:
this_err = self.send_message(chat_id, message)
this_err = self.send_message(chat_id, subject, message)
if this_err is not None:
err = this_err
return err
Expand Down
4 changes: 2 additions & 2 deletions node_monitor/node_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ def broadcaster(node_provider_id: str,
if self.slack_bot:
channels = slack_channels.get(node_provider_id, [])
if channels:
err1 = self.slack_bot.send_messages(channels, message)
err1 = self.slack_bot.send_messages(channels, subject, message)
if preferences['notify_telegram'] == True:
if self.telegram_bot:
chats = telegram_chats.get(node_provider_id, [])
if chats:
err2 = self.telegram_bot.send_messages(chats, message)
err2 = self.telegram_bot.send_messages(chats, subject, message)
return None

return broadcaster
Expand Down

0 comments on commit dc6a8b7

Please sign in to comment.