Fixed proxy switch
This commit is contained in:
@@ -28,7 +28,7 @@ general_group_chat_id = os.environ.get("GENERAL_GROUP_CHAT_ID")
|
||||
vip_group_chat_id = os.environ.get("VIP_GROUP_CHAT_ID")
|
||||
bot_token = os.environ.get("TELEGRAM_TOKEN")
|
||||
spreadsheet_id = os.environ.get("SPREADSHEET_ID")
|
||||
telegram_proxy = os.environ.get("TELEGRAM_PROXY")
|
||||
telegram_proxy = os.environ.get("TELEGRAM_PROXY") == '1'
|
||||
if telegram_proxy:
|
||||
telegram_socks_user = os.environ.get("TELEGRAM_SOCKS_USER")
|
||||
telegram_socks_password = os.environ.get("TELEGRAM_SOCKS_PASSWORD")
|
||||
@@ -765,8 +765,10 @@ async def help(update: Update, context: CallbackContext):
|
||||
|
||||
def main()->None:
|
||||
if telegram_proxy:
|
||||
logging.info("Creating application with socks5 proxy")
|
||||
application = ApplicationBuilder().get_updates_http_version('1.1').http_version('1.1').token(bot_token).proxy(proxy_url).get_updates_proxy(proxy_url).build()
|
||||
else:
|
||||
logging.info("Creating application without socks5 proxy")
|
||||
application = ApplicationBuilder().get_updates_http_version('1.1').http_version('1.1').token(bot_token).build()
|
||||
|
||||
conv_handler = ConversationHandler(
|
||||
|
||||
@@ -15,6 +15,7 @@ services:
|
||||
- GENERAL_GROUP_CHAT_ID=${GENERAL_GROUP_CHAT_ID}
|
||||
- VIP_GROUP_CHAT_ID=${VIP_GROUP_CHAT_ID}
|
||||
- SPREADSHEET_ID=${SPREADSHEET_ID}
|
||||
- TELEGRAM_PROXY=${TELEGRAM_PROXY}
|
||||
- TELEGRAM_SOCKS_USER=${TELEGRAM_SOCKS_USER}
|
||||
- TELEGRAM_SOCKS_PASSWORD=${TELEGRAM_SOCKS_PASSWORD}
|
||||
- TELEGRAM_SOCKS_SERVER=${TELEGRAM_SOCKS_SERVER}
|
||||
|
||||
Reference in New Issue
Block a user