Skip to content

Commit

Permalink
fix: resolve UnboundLocalError if update version is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobLichterfeld committed Mar 21, 2024
1 parent 47c09a5 commit 5d6267f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

### Bug Fixes

- fix: resolve UnboundLocalError if update version is empty

## [0.7.3] - 2023-03-21

### New Features
Expand Down
12 changes: 6 additions & 6 deletions src/teslamate_telegram_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,19 +169,19 @@ async def check_state_and_send_messages(bot, chat_id):
"A new SW update to version: " \
+ state.update_version \
+ " for your Tesla is available!"
await send_telegram_message_to_chat_id(bot, chat_id, message_text)
await send_telegram_message_to_chat_id(bot, chat_id, message_text)

# Mark the message as sent
state.update_available_message_sent = True
logging.debug("Message sent flag set.")
# Mark the message as sent
state.update_available_message_sent = True
logging.debug("Message sent flag set.")


async def send_telegram_message_to_chat_id(bot, chat_id, message_text):
async def send_telegram_message_to_chat_id(bot, chat_id, message_text_to_send):
""" Send a message to a chat ID """
logging.debug("Sending message.")
await bot.send_message(
chat_id,
text=message_text,
text=message_text_to_send,
parse_mode=ParseMode.HTML,
)
logging.debug("Message sent.")
Expand Down

0 comments on commit 5d6267f

Please sign in to comment.