File tree 2 files changed +16
-2
lines changed
2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -166,7 +166,17 @@ def start_bot(self):
166
166
167
167
# Build bot
168
168
telegram_config = self .config .get ("telegram" )
169
- builder = ApplicationBuilder ().token (telegram_config .get ("api_key" ))
169
+ proxy = telegram_config .get ("proxy" )
170
+ if proxy :
171
+ logging .info (f"Using proxy { proxy } for Telegram bot" )
172
+ builder = (
173
+ ApplicationBuilder ()
174
+ .token (telegram_config .get ("api_key" ))
175
+ .proxy (proxy )
176
+ .get_updates_proxy (proxy )
177
+ )
178
+ else :
179
+ builder = ApplicationBuilder ().token (telegram_config .get ("api_key" ))
170
180
self ._application = builder .build ()
171
181
172
182
# Set commands
Original file line number Diff line number Diff line change 116
116
"command" : " chatid" ,
117
117
"description" : " 🆔 Show your chat_id"
118
118
}
119
- ]
119
+ ],
120
+
121
+ "__comment15__" : " If needed, specify proxy in http://ip:port format (specify http even if it's https proxy)" ,
122
+ "__comment16__" : " Use http://username:password@ip:port format in case of proxy with authorization" ,
123
+ "proxy" : " "
120
124
},
121
125
122
126
"__comment07__" : " Save all requests and responses to the files" ,
You can’t perform that action at this time.
0 commit comments