From 4a256ed7ca55859d195d374370666af5429bfb48 Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 23 Dec 2024 19:57:05 +0100 Subject: [PATCH] chore: failed messages shouldn't return the wrapper but None --- freqtrade/rpc/telegram.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/freqtrade/rpc/telegram.py b/freqtrade/rpc/telegram.py index 1b5653b1d..70f3d26c1 100644 --- a/freqtrade/rpc/telegram.py +++ b/freqtrade/rpc/telegram.py @@ -90,6 +90,7 @@ class TimeunitMappings: def authorized_only(command_handler: Callable[..., Coroutine[Any, Any, None]]): """ Decorator to check if the message comes from the correct chat_id + can only be used with Telegram Class to decorate instance methods. :param command_handler: Telegram CommandHandler :return: decorated function """ @@ -108,7 +109,7 @@ def authorized_only(command_handler: Callable[..., Coroutine[Any, Any, None]]): chat_id = int(self._config["telegram"]["chat_id"]) if cchat_id != chat_id: logger.info(f"Rejected unauthorized message from: {update.message.chat_id}") - return wrapper + return None # Rollback session to avoid getting data stored in a transaction. Trade.rollback() logger.debug("Executing handler: %s for chat_id: %s", command_handler.__name__, chat_id)