Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
API_TOKEN=asd
GROUP_ID=asd
CHANNEL_ID=asd
CHANNEL_ID=asd
# Optional SOCKS5 proxy for Telegram API requests, e.g. socks5://user:pass@host:port

Copilot AI Apr 13, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the PR’s goal (working around networks that may block Telegram), consider documenting socks5h:// here instead of socks5://. In requests/PySocks, socks5h proxies DNS resolution through the proxy, which is often required when local DNS to Telegram is blocked.

Suggested change
# Optional SOCKS5 proxy for Telegram API requests, e.g. socks5://user:pass@host:port
# Optional SOCKS5 proxy for Telegram API requests, e.g. socks5h://user:pass@host:port

Copilot uses AI. Check for mistakes.
SOCKS5_PROXY_URL=
7 changes: 6 additions & 1 deletion bot.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import telebot
from telebot import types
from telebot import types, apihelper
import json
from datetime import datetime
import os
Expand All @@ -16,6 +16,11 @@
API_TOKEN = os.getenv('API_TOKEN')
GROUP_ID = int(os.getenv('GROUP_ID'))
CHANNEL_ID = int(os.getenv('CHANNEL_ID'))

socks5_proxy_url = os.getenv('SOCKS5_PROXY_URL')
if socks5_proxy_url:
apihelper.proxy = {'https': socks5_proxy_url}

bot = telebot.TeleBot(API_TOKEN)

my_id = bot.get_me().id
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pyTelegramBotAPI
flask
flask_sqlalchemy
python-dotenv
python-dotenv
requests[socks]