Skip to content

Commit

Permalink
feat: change curl dependency to wget
Browse files Browse the repository at this point in the history
This commit changes the dependency on curl to wget since this is
installed by default on most linux systems. Additionally documentationw
was added to explain that wget is needed for the telegram feature.
  • Loading branch information
rickstaa committed Jun 10, 2023
1 parent fd7bac7 commit 46749cd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ Put both `set -g @tnotify-telegram-bot-id 'your telegram bot id'` and `set -g @t

- `prefix + ctrl + alt + M`: Start monitoring a pane, return it in focus and notify in bash and telegram when it finishes.

> **Warning**
> This feature requires [wget](https://www.gnu.org/software/wget/) to be installed on your system.
> **Note**
> You can get your telegram bot id by creating a bot using [BotFather](https://core.telegram.org/bots#6-botfather) and your channel id by sending your channel invite link to the `@username_to_id_bot` bot.
Expand Down
4 changes: 2 additions & 2 deletions scripts/helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ telegram_available() {
# Send telegram message
# Usage: send_telegram_message <bot_id> <chat_id> <message>
send_telegram_message() {
curl "https://api.telegram.org/bot$1/sendMessage?chat_id=$2&text=$3" &> /dev/null
wget --spider "https://api.telegram.org/bot$1/sendMessage?chat_id=$2&text=${3// /%20}" &> /dev/null
}

# Send notification
Expand All @@ -71,7 +71,7 @@ notify() {
if telegram_available && (telegram_all_enabled || [ "$2" == "true" ]); then
telegram_bot_id="$(get_tmux_option "$tmux_notify_telegram_bot_id" "$tmux_notify_telegram_bot_id_default")"
telegram_chat_id="$(get_tmux_option "$tmux_notify_telegram_channel_id" "$tmux_notify_telegram_channel_id_default")"
send_telegram_message $telegram_bot_id $telegram_chat_id "$1" &> /dev/null
send_telegram_message $telegram_bot_id $telegram_chat_id "$1"
fi

# trigger visual bell
Expand Down

0 comments on commit 46749cd

Please sign in to comment.