From 437105020655b3c441cebcf663d508ea83d815ac Mon Sep 17 00:00:00 2001 From: "Kay Marquardt (Gnadelwartz)" Date: Fri, 22 Jan 2021 08:18:17 +0100 Subject: [PATCH] bin: rename to edit_message.sh --- bin/edit_message.sh | 67 ++++++++++++++++++++++++++++++++++++++++ bin/send_buttons.sh | 6 ++-- bin/send_edit_message.sh | 2 +- 3 files changed, 71 insertions(+), 4 deletions(-) create mode 100755 bin/edit_message.sh diff --git a/bin/edit_message.sh b/bin/edit_message.sh new file mode 100755 index 0000000..e7fb7f9 --- /dev/null +++ b/bin/edit_message.sh @@ -0,0 +1,67 @@ +#!/bin/bash +# shellcheck disable=SC1090,SC2034 +#=============================================================================== +# +# FILE: bin/send_message.sh +# +USAGE='send_edit_message.sh [-h|--help] [format|caption] "CHAT[ID]" "MESSAGE[ID]" "message ...." [debug]' +# +# DESCRIPTION: replace a message in the given user/group +# +# OPTIONS: format - normal, markdown, html or caption for file caption (optional) +# CHAT[ID] - ID number of CHAT or BOTADMIN to send to yourself +# MESSAGE[ID] - message to replace +# message - message to send in specified format +# if no format is given send_normal_message() format is used +# +# -h - display short help +# --help - this help +# +# Set BASHBOT_HOME to your installation directory +# +# LICENSE: WTFPLv2 http://www.wtfpl.net/txt/copying/ +# AUTHOR: KayM (gnadelwartz), kay@rrr.de +# CREATED: 23.12.2020 16:52 +# +#### $$VERSION$$ v1.31-dev-14-g749eee7 +#=============================================================================== + +#### +# parse args +SEND="edit_normal_message" +case "$1" in + "nor"*|"tex"*) + SEND="edit_normal_message" + shift + ;; + "mark"*) + SEND="edit_markdownv2_message" + shift + ;; + "htm"*) + SEND="edit_html_message" + shift + ;; + "cap"*) + SEND="edit_message_caption" + shift + ;; +esac + +# set bashbot environment +source "${0%/*}/bashbot_env.inc.sh" "${4:-debug}" # $4 debug +print_help + +#### +# ready, do stuff here ----- +if [ "$1" == "BOTADMIN" ]; then + CHAT="${BOT_ADMIN}" +else + CHAT="$1" +fi + +# send message in selected format +"${SEND}" "${CHAT}" "$2" "$3" + +# output send message result +print_result diff --git a/bin/send_buttons.sh b/bin/send_buttons.sh index d491531..28fd571 100755 --- a/bin/send_buttons.sh +++ b/bin/send_buttons.sh @@ -25,7 +25,7 @@ USAGE='send_message.sh [-h|--help] "CHAT[ID]" "message" "text|url" ...' # AUTHOR: KayM (gnadelwartz), kay@rrr.de # CREATED: 18.01.2021 11:34 # -#### $$VERSION$$ v1.31-dev-14-g749eee7 +#### $$VERSION$$ v1.32-dev-1-g662c6f4 #=============================================================================== #### @@ -43,11 +43,11 @@ if [ "$1" == "BOTADMIN" ]; then else CHAT="$1" fi -TEXT="$2" +MESSAGE="$2" shift 2 # send message in selected format -"${SEND}" "${CHAT}" "${TEXT}" "$(_button_row "$@")" +"${SEND}" "${CHAT}" "${MESSAGE}" "$(_button_row "$@")" # output send message result print_result diff --git a/bin/send_edit_message.sh b/bin/send_edit_message.sh index e7fb7f9..5be25e3 100755 --- a/bin/send_edit_message.sh +++ b/bin/send_edit_message.sh @@ -23,7 +23,7 @@ USAGE='send_edit_message.sh [-h|--help] [format|caption] "CHAT[ID]" "MESSAGE[ID] # AUTHOR: KayM (gnadelwartz), kay@rrr.de # CREATED: 23.12.2020 16:52 # -#### $$VERSION$$ v1.31-dev-14-g749eee7 +#### $$VERSION$$ v1.32-dev-1-g662c6f4 #=============================================================================== ####