@@ -97,17 +97,17 @@ def authorized_only(command_handler: Callable[..., Coroutine[Any, Any, None]]):
97
97
"""
98
98
99
99
@wraps (command_handler )
100
- async def wrapper (self , * args , ** kwargs ):
100
+ async def wrapper (self , * args , ** kwargs ) -> None :
101
101
"""Decorator logic"""
102
- update : Update = kwargs .get ("update" ) or args [0 ]
102
+ update = kwargs .get ("update" ) or args [0 ]
103
103
104
104
# Reject unauthorized messages
105
105
message : Message = (
106
106
update .message if update .callback_query is None else update .callback_query .message
107
107
)
108
108
cchat_id : int = int (message .chat_id )
109
109
ctopic_id : int | None = message .message_thread_id
110
- from_user_id : str = str (update .effective_user .id )
110
+ from_user_id : str = str (update .effective_user .id if update . effective_user else "" )
111
111
112
112
chat_id = int (self ._config ["telegram" ]["chat_id" ])
113
113
if cchat_id != chat_id :
@@ -2158,7 +2158,9 @@ async def _tg_info(self, update: Update, context: CallbackContext) -> None:
2158
2158
return
2159
2159
chat_id = update .message .chat_id
2160
2160
topic_id = update .message .message_thread_id
2161
- user_id = update .message .from_user .id if topic_id is not None else None
2161
+ user_id = (
2162
+ update .effective_user .id if topic_id is not None and update .effective_user else None
2163
+ )
2162
2164
2163
2165
msg = f"""Freqtrade Bot Info:
2164
2166
```json
@@ -2167,7 +2169,7 @@ async def _tg_info(self, update: Update, context: CallbackContext) -> None:
2167
2169
"token": "********",
2168
2170
"chat_id": "{ chat_id } ",
2169
2171
{ f'"topic_id": "{ topic_id } ",' if topic_id else "" }
2170
- { f'//"authorized_users": ["{ user_id } "]' if topic_id else "" }
2172
+ { f'//"authorized_users": ["{ user_id } "]' if topic_id and user_id else "" }
2171
2173
}}
2172
2174
```
2173
2175
"""
0 commit comments