Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added option to resolve DNS of host manually #35

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
8 changes: 7 additions & 1 deletion telegram
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ function help {
echo " -C Sends text as monospace code. Useful when piping command outputs into this tool."
echo " -r Like -C, but if the first line starts with '+ ', it is specially formatted."
echo " -T <TITLE> Sets a title for the message. Printed in bold text if -M or -H is used."
echo " -I Resolves the IP of the Telegram API Host manually by using Google DNS to mitigate DNS issues."
echo " -l Fetch known chat_ids."
echo " -R Receive a file sent via telegram."
echo " -D Sets disable_web_page_preview parameter to, well, disable the preview for links to webpages."
Expand Down Expand Up @@ -210,7 +211,7 @@ function escapeMarkdown {
echo "$res"
}

while getopts "t:c:i:f:V:MHCrhlvjnRmDNT:" opt; do
while getopts "t:c:i:f:V:MHCrhlvjnRmDNIT:" opt; do
case $opt in
t)
TOKEN="$OPTARG"
Expand Down Expand Up @@ -268,6 +269,11 @@ while getopts "t:c:i:f:V:MHCrhlvjnRmDNT:" opt; do
T)
TITLE="$OPTARG"
;;
I)
TELEGRAM_HOST=`echo "$URL" | sed 's,https://,,;s,/bot,,'`
TELEGRAM_IP=`dig @8.8.8.8 $TELEGRAM_HOST +short`
CURL_OPTIONS="$CURL_OPTIONS --resolve ${URL%/bot}:$TELEGRAM_IP"
;;
?|h)
help
;;
Expand Down