mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2024-12-29 05:02:46 +00:00
add check and use of BOTADMIN in bin/ scripts
This commit is contained in:
parent
269cbfb1d2
commit
f281ae0f6f
@ -8,7 +8,7 @@
|
|||||||
# DESCRIPTION: replace a message in the given user/group
|
# DESCRIPTION: replace a message in the given user/group
|
||||||
#
|
#
|
||||||
# OPTIONS: format - normal, markdown, html (optional)
|
# OPTIONS: format - normal, markdown, html (optional)
|
||||||
# CHAT[ID] - ID number of CHAT
|
# CHAT[ID] - ID number of CHAT or BOTADMIN to send to yourself
|
||||||
# MESSAGE[ID] - message to replace
|
# MESSAGE[ID] - message to replace
|
||||||
# message - message to send in specified format
|
# message - message to send in specified format
|
||||||
# if no format is given send_normal_message() format is used
|
# if no format is given send_normal_message() format is used
|
||||||
@ -22,13 +22,9 @@
|
|||||||
# AUTHOR: KayM (gnadelwartz), kay@rrr.de
|
# AUTHOR: KayM (gnadelwartz), kay@rrr.de
|
||||||
# CREATED: 23.12.2020 16:52
|
# CREATED: 23.12.2020 16:52
|
||||||
#
|
#
|
||||||
#### $$VERSION$$ v1.2-dev2-62-gfa24673
|
#### $$VERSION$$ v1.2-dev2-72-g269cbfb
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
|
|
||||||
# set bashbot environment
|
|
||||||
# shellcheck disable=SC1090
|
|
||||||
source "${0%/*}/bashbot_env.inc.sh"
|
|
||||||
|
|
||||||
####
|
####
|
||||||
# parse args
|
# parse args
|
||||||
SEND="edit_normal_message"
|
SEND="edit_normal_message"
|
||||||
@ -58,15 +54,29 @@ case "$1" in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
# set bashbot environment
|
||||||
|
# shellcheck disable=SC1090
|
||||||
|
source "${0%/*}/bashbot_env.inc.sh"
|
||||||
|
|
||||||
# source bashbot and send message
|
# source bashbot and send message
|
||||||
# shellcheck disable=SC1090
|
# shellcheck disable=SC1090
|
||||||
source "${BASHBOT_HOME}/bashbot.sh" source "$4"
|
source "${BASHBOT_HOME}/bashbot.sh" source "$3"
|
||||||
|
|
||||||
|
ADMIN="$(getConfigKey "botadmin")"
|
||||||
|
[ "${ADMIN}" = "?" ] && echo -e "${ORANGE}Warning: Botadmin not set, did you forget to sent command${NC} /start?"
|
||||||
|
|
||||||
|
####
|
||||||
####
|
####
|
||||||
# ready, do stuff here -----
|
# ready, do stuff here -----
|
||||||
|
if [ "$1" == "BOTADMIN" ]; then
|
||||||
|
CHAT="${ADMIN}"
|
||||||
|
else
|
||||||
|
CHAT="$1"
|
||||||
|
fi
|
||||||
|
|
||||||
# send message in selected format
|
# send message in selected format
|
||||||
"${SEND}" "$1" "$2" "$3"
|
"${SEND}" "${CHAT}" "$2" "$3"
|
||||||
|
|
||||||
# output send message result
|
# output send message result
|
||||||
jssh_printDB "BOTSENT" | sort -r
|
jssh_printDB "BOTSENT" | sort -r
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
# DESCRIPTION: send a message to the given user/group
|
# DESCRIPTION: send a message to the given user/group
|
||||||
#
|
#
|
||||||
# OPTIONS: format - normal, markdown, html (optional)
|
# OPTIONS: format - normal, markdown, html (optional)
|
||||||
# CHAT[ID] - ID number of CHAT
|
# CHAT[ID] - ID number of CHAT or BOTADMIN to send to yourself
|
||||||
# message - message to send in specified format
|
# message - message to send in specified format
|
||||||
# if no format is givern send_message() format is used
|
# if no format is givern send_message() format is used
|
||||||
#
|
#
|
||||||
@ -21,12 +21,9 @@
|
|||||||
# AUTHOR: KayM (gnadelwartz), kay@rrr.de
|
# AUTHOR: KayM (gnadelwartz), kay@rrr.de
|
||||||
# CREATED: 16.12.2020 11:34
|
# CREATED: 16.12.2020 11:34
|
||||||
#
|
#
|
||||||
#### $$VERSION$$ v1.2-dev2-62-gfa24673
|
#### $$VERSION$$ v1.2-dev2-72-g269cbfb
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
|
|
||||||
# set bashbot environment
|
|
||||||
# shellcheck disable=SC1090
|
|
||||||
source "${0%/*}/bashbot_env.inc.sh"
|
|
||||||
|
|
||||||
####
|
####
|
||||||
# parse args
|
# parse args
|
||||||
@ -57,15 +54,27 @@ case "$1" in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# set bashbot environment
|
||||||
|
# shellcheck disable=SC1090
|
||||||
|
source "${0%/*}/bashbot_env.inc.sh"
|
||||||
|
|
||||||
# source bashbot and send message
|
# source bashbot and send message
|
||||||
# shellcheck disable=SC1090
|
# shellcheck disable=SC1090
|
||||||
source "${BASHBOT_HOME}/bashbot.sh" source "$3"
|
source "${BASHBOT_HOME}/bashbot.sh" source "$3"
|
||||||
|
|
||||||
|
ADMIN="$(getConfigKey "botadmin")"
|
||||||
|
[ "${ADMIN}" = "?" ] && echo -e "${ORANGE}Warning: Botadmin not set, did you forget to sent command${NC} /start?"
|
||||||
|
|
||||||
####
|
####
|
||||||
# ready, do stuff here -----
|
# ready, do stuff here -----
|
||||||
|
if [ "$1" == "BOTADMIN" ]; then
|
||||||
|
CHAT="${ADMIN}"
|
||||||
|
else
|
||||||
|
CHAT="$1"
|
||||||
|
fi
|
||||||
|
|
||||||
# send message in selected format
|
# send message in selected format
|
||||||
"${SEND}" "$1" "$2"
|
"${SEND}" "${CHAT}" "$2"
|
||||||
|
|
||||||
# output send message result
|
# output send message result
|
||||||
jssh_printDB "BOTSENT" | sort -r
|
jssh_printDB "BOTSENT" | sort -r
|
||||||
|
Loading…
Reference in New Issue
Block a user