From aec73450af5238c7230de5f03c753c95bcf53f2c Mon Sep 17 00:00:00 2001 From: "Kay Marquardt (Gnadelwartz)" Date: Sat, 1 Aug 2020 09:10:14 +0200 Subject: [PATCH] correct/beautify misspelled comments --- modules/sendMessage.sh | 2 +- mycommands.sh | 48 +++++++++++++++++++++++------------------- mycommands.sh.clean | 20 +++++++++--------- 3 files changed, 37 insertions(+), 33 deletions(-) diff --git a/modules/sendMessage.sh b/modules/sendMessage.sh index 6afb90c..7c204dc 100644 --- a/modules/sendMessage.sh +++ b/modules/sendMessage.sh @@ -5,7 +5,7 @@ # This file is public domain in the USA and all free countries. # Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying) # -#### $$VERSION$$ 0.99-3-gc9e5c0f +#### $$VERSION$$ 0.99-4-g15eb311 # will be automatically sourced from bashbot diff --git a/mycommands.sh b/mycommands.sh index ad20f4b..a4493d8 100644 --- a/mycommands.sh +++ b/mycommands.sh @@ -3,12 +3,12 @@ # # files: mycommands.sh.dist # -# this is an out of the box test and example file to show what you can do in mycommands.sh +# this is an out of the box test and example file to show what's possible in mycommands.sh # # #### if you start to develop your own bot, use the clean version of this file: # #### mycommands.clean # -#### $$VERSION$$ 0.99-0-g2775000 +#### $$VERSION$$ 0.99-4-g15eb311 # # uncomment the following lines to overwrite info and help messages @@ -24,39 +24,37 @@ export INLINE="0" # Set to .* to allow sending files from all locations # NOTE: this is a regex, not shell globbing! you must use a valid egex, # '.' matches any character and '.*' matches all remaining charatcers! -# additionally you must escape special characters with '\', e.g. '\. \? \[ \*" to match them literally +# additionally you must escape special characters with '\', e.g. '\. \? \[ \*" to match them literally export FILE_REGEX="${BASHBOT_ETC}/.*" -# example: run bashbot over TOR -# export BASHBOT_CURL_ARGS="--socks5-hostname 127.0.0.1:9050" # set BASHBOT_RETRY to enable retry in case of recoverable errors, e.g. throtteling -# problems with send_,´message etc are looged to logs/ERROR.log +# problems with send_xxx message etc are looged to logs/ERROR.log unset BASHBOT_RETRY #export BASHBOT_RETRY="yes" -# set value for adaptive sleeping while waitingnfor uodates in millisconds +# set value for adaptive sleeping while waiting for uodates in millisconds # max slepp between polling updates 10s (default 5s) export BASHBOT_SLEEP="10000" # add 0.2s if no update available, up to BASHBOT_SLEEP (default 0.1s) export BASHBOT_SLEEP_STEP="200" -# if you want to use timer functions, set BASHBOT_START_TImer to not empty value -# default is to nit start timer +# if you want to use timer functions, set BASHBOT_START_TIMER to a not empty value +# default is to not start timer unset BASHBOT_START_TIMER #export BASHBOT_START_TIMER="yes" -# set to "yes" and give your bot admin privilegs to remove service messaes from groups +# set to "yes" and give your bot admin privilegs to remove service messages from groups export SILENCER="no" -# uncomment if you use keyboards in your commands +# uncomment to remove keyboards sent from your bot # export REMOVEKEYBOARD="yes" # export REMOVEKEYBOARD_PRIVATE="yes" -# uncomment if you want to say welcome to new chat members +# uncomment to say welcome to new chat members # export WELCOME_NEWMEMBER="yes" WELCOME_MSG="Welcome" -# uncomment if you want to be informed about new/left chat members +# uncomment to be informed about new/left chat members # export REPORT_NEWMEMBER="yes" # export REPORT_LEFTMEMBER="yes" @@ -64,6 +62,13 @@ WELCOME_MSG="Welcome" NOTADMIN="Sorry, this command is allowed for admin or owner only" NOTBOTADMIN="Sorry, this command is allowed for bot owner only" +######## +# special network setup may require additional ARGS to curl +# +# example: run bashbot over TOR or SOCKS proxy +# export BASHBOT_CURL_ARGS="--socks5-hostname 127.0.0.1:9050" # TOR +# export BASHBOT_CURL_ARGS="--socks5-hostname 127.0.0.1" # regular SOCKS + if [ "$1" = "startbot" ];then ################### # this function is run once after startup when the first message is received @@ -71,17 +76,16 @@ if [ "$1" = "startbot" ];then # send message ito first user on startup send_normal_message "${CHAT[ID]}" "Hi, you was the first one after startup!" } - # reminde bot that it was started + # remind bot of start, replace by jsonDB ? touch .mystartup else - # here we call the function above when the message arrives - # things to do only at source, eg. after startup + # call my_startup when first message arrives [ -f .mystartup ] && rm -f .mystartup && _exec_if_function my_startup ############################# # your own bashbot commands - # NOTE: command can have @botname attached, you must add * in case tests... - mycommands() { + # NOTE: command can have @botname attached, you must add * to case tests... + mycommands() { ############## # a service Message was received @@ -113,7 +117,7 @@ else # fix first letter upper case because of smartphone auto correction [[ "${MESSAGE}" =~ ^/[[:upper:]] ]] && MESSAGE="${MESSAGE:0:1}$(tr '[:upper:]' '[:lower:]' <<<"${MESSAGE:1:1}")${MESSAGE:2}" - # pre-check admin only commands + # pre-check admin only commands case "${MESSAGE}" in # must be private, group admin, or botadmin '/run_'*|'stop_'*) @@ -233,7 +237,7 @@ else " ;; - "4") # four photo from array + "4") # four photos from array local sep="" local avatar=("https://avatars.githubusercontent.com/u/13046303" "https://avatars.githubusercontent.com/u/4593242" "https://avatars.githubusercontent.com/u/102707" "https://avatars.githubusercontent.com/u/6460407") answer_inline_multi "${iQUERY[ID]}" " @@ -243,7 +247,7 @@ else " ;; - "sticker") # example chaecd telegram sticker + "sticker") # example cached telegram sticker answer_inline_query "${iQUERY[ID]}" "cached_sticker" "BQADBAAD_QEAAiSFLwABWSYyiuj-g4AC" ;; "gif") # example cached gif @@ -260,7 +264,7 @@ else [ -f ".jssh" ] && printf "%s: %s\n" "${1}" "Ups, found file \"${PWD:-.}/.jssh\"! ==========" } - # called when bashbot sedn command failed because we can not connect to telegram + # called when bashbot send_xxx command failed because we can not connect to telegram # return 0 to retry, return non 0 to give up bashbotBlockRecover() { # place your commands to unblock here, e.g. change IP or simply wait diff --git a/mycommands.sh.clean b/mycommands.sh.clean index cadf216..dd00f35 100644 --- a/mycommands.sh.clean +++ b/mycommands.sh.clean @@ -4,7 +4,7 @@ # files: mycommands.sh.clean # copy to mycommands.sh and add all your commands and functions here ... # -#### $$VERSION$$ 0.99-0-g2775000 +#### $$VERSION$$ 0.99-4-g15eb311 # ########## @@ -18,17 +18,17 @@ export bashbot_help='*Available commands*: export res="" # Set INLINE to 1 in order to receive inline queries. -# To enable this option in your bot ypu must also send the /setinline command to @BotFather. +# To enable this option in your bot must also send the /setinline command to @BotFather. export INLINE="0" # NOTE: this is a regex, not shell globbing! you must use a valid egex, # '.' matches any character and '.*' matches all remaining charatcers! -# additionally you must escape special characters with '\', e.g. '\. \? \[ \*" to match them literally +# additionally you must escape special characters with '\', e.g. '\. \? \[ \*" to match them literally # do NOT set to .* as this allow sending files from all locations! export FILE_REGEX="${BASHBOT_ETC}/.*" # set BASHBOT_RETRY to enable retry in case of recoverable errors, e.g. throtteling -# problems with send_,´message etc are looged to logs/ERROR.log +# problems with send_,´message etc are looged to logs/ERROR.log unset BASHBOT_RETRY #export BASHBOT_RETRY="yes" @@ -38,19 +38,19 @@ export BASHBOT_SLEEP="10000" # add 0.2s if no update available, up to BASHBOT_SLEEP (default 0.1s) export BASHBOT_SLEEP_STEP="200" -# if you want to use timer functions, set BASHBOT_START_TImer to not empty value +# if you want to use timer functions, set BASHBOT_START_TIMER to a not empty value # default is to nit start timer unset BASHBOT_START_TIMER #export BASHBOT_START_TIMER="yes" # set to "yes" and give your bot admin privilegs to remove service messaes from groups export SILENCER="no" -# uncomment if you use keyboards in your commands +# uncomment to remove keyboards sent by your bot # export REMOVEKEYBOARD="yes" # export REMOVEKEYBOARD_PRIVATE="yes" ######## -# special network setups may require to provide additional ARGS to curl +# special network setup may require additional ARGS to curl # # example: run bashbot over TOR or SOCKS proxy # export BASHBOT_CURL_ARGS="--socks5-hostname 127.0.0.1:9050" # TOR @@ -63,13 +63,13 @@ if [ "$1" = "startbot" ];then } touch .mystartup else - # here we call the function above when the message arrives - # things to do only at source, eg. after startup + # call my_startup on first message after startup + # things to do only once [ -f .mystartup ] && rm -f .mystartup && _exec_if_function my_startup ############################# # your own bashbot commands - # NOTE: command can have @botname attached, you must add * in case tests... + # NOTE: command can have @botname attached, you must add * to case tests... mycommands() { ##############