Merge pull request #195 from dcoomber/develop

Miscellaneous grammar / formatting update

Thank you!
This commit is contained in:
Kay Marquardt 2022-08-14 09:36:39 +02:00 committed by GitHub
commit 8a6d3ff3b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 16 deletions

View File

@ -31,7 +31,7 @@ unset IFS
# kill interactive script if not finished in time, e.g. user away or error # kill interactive script if not finished in time, e.g. user away or error
MAXWAIT="1m" MAXWAIT="1m"
{ sleep "${MAXWAIT}"; printf "Stopping Questionnaire after %s, you need to much time to finish ... BYE\n" "${MAXWAIT}"; kill $$; wait 2>/dev/null ;} & { sleep "${MAXWAIT}"; printf "Stopping questionnaire after %s. You've taken too long to finish! BYE\n" "${MAXWAIT}"; kill $$; wait 2>/dev/null ;} &
# simple yes/no question, defaults to no # simple yes/no question, defaults to no
printf "Hi, hello there\nWould you like some tea (y/n)?\n" printf "Hi, hello there\nWould you like some tea (y/n)?\n"
@ -39,15 +39,15 @@ read -r answer <"${INPUT}"
if [[ ${answer,,} == "y"* ]]; then if [[ ${answer,,} == "y"* ]]; then
printf "OK then, here you go: http://www.rivertea.com/blog/wp-content/uploads/2013/12/Green-Tea.jpg\n" printf "OK then, here you go: http://www.rivertea.com/blog/wp-content/uploads/2013/12/Green-Tea.jpg\n"
else else
printf "OK then, no tea ...\n" printf "OK then, no tea...\n"
fi fi
# question with Keyboard, repeating until correct answer given # question with keyboard, repeating until correct answer given
until [ "${SUCCESS}" = "y" ] ;do until [ "${SUCCESS}" = "y" ] ;do
printf 'Do you like Music? mykeyboardstartshere "Yass!" , "No"\n' printf 'Do you like music? mykeyboardstartshere "Yass!" , "No"\n'
read -r answer <"${INPUT}" read -r answer <"${INPUT}"
case ${answer,,} in case ${answer,,} in
'') printf "empty answer! Try again\n";; '') printf "Empty answer! Try again\n";;
'yass'*) printf "Goody! mykeyboardendshere\n";SUCCESS=y;; 'yass'*) printf "Goody! mykeyboardendshere\n";SUCCESS=y;;
'no'*) printf "Well that's weird. mykeyboardendshere\n";SUCCESS=y;; 'no'*) printf "Well that's weird. mykeyboardendshere\n";SUCCESS=y;;
*) SUCCESS=n;; *) SUCCESS=n;;

View File

@ -48,7 +48,7 @@ else
fi fi
############## ##############
# a service Message was received # a service message was received
# add your own stuff here # add your own stuff here
if [ -n "${SERVICE}" ]; then if [ -n "${SERVICE}" ]; then
@ -94,7 +94,7 @@ else
send_markdownv2_message "${CHAT[ID]}" "*${NOTBOTADMIN}*"; return 1 send_markdownv2_message "${CHAT[ID]}" "*${NOTBOTADMIN}*"; return 1
fi fi
;; ;;
# will we process edited messages also? # will we also process edited messages?
'/_edited_message'*) '/_edited_message'*)
return 1 # no return 1 # no
# but if we do, remove /edited_message # but if we do, remove /edited_message
@ -123,22 +123,22 @@ else
case "${MESSAGE}" in case "${MESSAGE}" in
################## ##################
# example commands, replace them by your own # example commands, replace them with your own
'/_dice_re'*) # dice from user received '/_dice_re'*) # dice from user received
sleep 5 sleep 5
local gameresult="*Congratulation ${USER[FIRST_NAME]} ${USER[LAST_NAME]}* you got *${MESSAGE[RESULT]} Points*." local gameresult="*Congratulations*, ${USER[FIRST_NAME]} ${USER[LAST_NAME]}, you got *${MESSAGE[RESULT]} points*."
[ -z "${FORWARD[UID]}" ] && send_markdownv2_message "${CHAT[ID]}" "${gameresult}" [ -z "${FORWARD[UID]}" ] && send_markdownv2_message "${CHAT[ID]}" "${gameresult}"
;; ;;
'/game'*) # send random dice, edit list to fit your needs '/game'*) # send random dice, edit list to fit your needs
send_dice "${CHAT[ID]}" ":$(printf "slot_machine\ngame_die\ndart\nbasketball\nsoccer\nslot_machine"|sort -R|shuf -n 1shuf -n 1):" send_dice "${CHAT[ID]}" ":$(printf "slot_machine\ngame_die\ndart\nbasketball\nsoccer\nslot_machine"|sort -R|shuf -n 1shuf -n 1):"
if [ "${BOTSENT[OK]}" = "true" ]; then if [ "${BOTSENT[OK]}" = "true" ]; then
local gameresult="*Congratulation ${USER[FIRST_NAME]}* ${USER[LAST_NAME]} you got *${BOTSENT[RESULT]} Points*." local gameresult="*Congratulations*, ${USER[FIRST_NAME]} ${USER[LAST_NAME]}, you got *${BOTSENT[RESULT]} points*."
sleep 5 sleep 5
case "${BOTSENT[RESULT]}" in case "${BOTSENT[RESULT]}" in
1) gameresult="*Sorry* only *one Point* ...";; 1) gameresult="*Sorry!* only *one point* ...";;
2) gameresult="*Hey*, 2 Points are *more then one!*";; 2) gameresult="*Hey*, 2 points are *better than one!*";;
5|6) [[ "${BOTSENT[EMOJI]}" =~ fb0$ ]] || gameresult="*Super! ${BOTSENT[RESULT]} Points!*";; 4|5) [[ "${BOTSENT[EMOJI]}" =~ fb0$ ]] || gameresult="*Super!* You got ${BOTSENT[RESULT]} points.";;
6*) gameresult="*JACKPOT! ${BOTSENT[RESULT]} Points!*";; 6*) gameresult="*JACKPOT!* ${BOTSENT[RESULT]} points!";;
esac esac
send_markdownv2_message "${CHAT[ID]}" "${gameresult}" send_markdownv2_message "${CHAT[ID]}" "${gameresult}"
fi fi
@ -292,7 +292,7 @@ else
esac esac
} }
# debug function called on start, stop of bot, interactive and background processes # debug function called on start, stop of bot, interactive and background processes
# if your bot was started with debug as second argument # if your bot was started with debug as second argument
# $1 current date, $2 from where the function was called, $3 ... $n optional information # $1 current date, $2 from where the function was called, $3 ... $n optional information
my_debug_checks() { my_debug_checks() {
@ -314,7 +314,7 @@ else
########################### ###########################
# example error processing # example error processing
# called when delete Message failed # called when delete message failed
# func="$1" err="$2" chat="$3" user="$4" emsg="$5" remaining args # func="$1" err="$2" chat="$3" user="$4" emsg="$5" remaining args
bashbotError_delete_message() { bashbotError_delete_message() {
log_debug "custom errorProcessing delete_message: ERR=$2 CHAT=$3 MSGID=$6 ERTXT=$5" log_debug "custom errorProcessing delete_message: ERR=$2 CHAT=$3 MSGID=$6 ERTXT=$5"