-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #182 Bashbot Version 1.51
Version 1.51
- Loading branch information
Showing
84 changed files
with
251 additions
and
304 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ USAGE='any_command.sh [-h|--help] [--force|--reference] bot_command args ...' | |
# AUTHOR: KayM (gnadelwartz), [email protected] | ||
# CREATED: 30.01.2021 10:24 | ||
# | ||
#### $$VERSION$$ v1.5-0-g8adca9b | ||
#### $$VERSION$$ v1.51-0-g6e66a28 | ||
#=============================================================================== | ||
|
||
#### | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ | |
# AUTHOR: KayM (gnadelwartz), [email protected] | ||
# CREATED: 18.12.2020 12:27 | ||
# | ||
#### $$VERSION$$ v1.5-0-g8adca9b | ||
#### $$VERSION$$ v1.51-0-g6e66a28 | ||
#=============================================================================== | ||
|
||
############ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
# AUTHOR: KayM (gnadelwartz), [email protected] | ||
# CREATED: 27.01.2021 13:42 | ||
# | ||
#### $$VERSION$$ v1.5-0-g8adca9b | ||
#### $$VERSION$$ v1.51-0-g6e66a28 | ||
#=============================================================================== | ||
# shellcheck disable=SC2059 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ USAGE='bashbot_stats.sh [-h|--help] [debug]' | |
# AUTHOR: KayM (gnadelwartz), [email protected] | ||
# CREATED: 23.12.2020 20:34 | ||
# | ||
#### $$VERSION$$ v1.5-0-g8adca9b | ||
#### $$VERSION$$ v1.51-0-g6e66a28 | ||
#=============================================================================== | ||
|
||
# set bashbot environment | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ USAGE='delete_message.sh [-h|--help] "CHAT[ID]" "MESSAGE[ID]" [debug]' | |
# AUTHOR: KayM (gnadelwartz), [email protected] | ||
# CREATED: 03.01.2021 15:37 | ||
# | ||
#### $$VERSION$$ v1.5-0-g8adca9b | ||
#### $$VERSION$$ v1.51-0-g6e66a28 | ||
#=============================================================================== | ||
|
||
#### | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ USAGE='send_message.sh [-h|--help] "CHAT[ID]" "MESSAGE[ID]" "text|url" ...' | |
# AUTHOR: KayM (gnadelwartz), [email protected] | ||
# CREATED: 21.01.2021 08:10 | ||
# | ||
#### $$VERSION$$ v1.5-0-g8adca9b | ||
#### $$VERSION$$ v1.51-0-g6e66a28 | ||
#=============================================================================== | ||
|
||
#### | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ USAGE='send_edit_message.sh [-h|--help] [format|caption] "CHAT[ID]" "MESSAGE[ID] | |
# AUTHOR: KayM (gnadelwartz), [email protected] | ||
# CREATED: 23.12.2020 16:52 | ||
# | ||
#### $$VERSION$$ v1.5-0-g8adca9b | ||
#### $$VERSION$$ v1.51-0-g6e66a28 | ||
#=============================================================================== | ||
|
||
#### | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ USAGE='kickban_user.sh [-h|--help] [-u|--unban] "CHAT[ID]" "USER[ID]" [debug]' | |
# AUTHOR: KayM (gnadelwartz), [email protected] | ||
# CREATED: 25.01.2021 20:34 | ||
# | ||
#### $$VERSION$$ v1.5-0-g8adca9b | ||
#### $$VERSION$$ v1.51-0-g6e66a28 | ||
#=============================================================================== | ||
|
||
#### | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
# | ||
# FILE: bin/process_batch.sh | ||
# | ||
USAGE='process_update.sh [-h|--help] [-s|--startbot] [-w|--watch] [-n|--lines n] [file] [debug]' | ||
USAGE='process_batch.sh [-h|--help] [-s|--startbot] [-w|--watch] [-n|--lines n] [file] [debug]' | ||
# | ||
# DESCRIPTION: processes last 10 telegram updates in file, one update per line | ||
# | ||
|
@@ -21,13 +21,14 @@ USAGE='process_update.sh [-h|--help] [-s|--startbot] [-w|--watch] [-n|--lines n] | |
# AUTHOR: KayM (gnadelwartz), [email protected] | ||
# CREATED: 27.02.2021 13:14 | ||
# | ||
#### $$VERSION$$ v1.5-0-g8adca9b | ||
#### $$VERSION$$ v1.51-0-g6e66a28 | ||
#=============================================================================== | ||
|
||
#### | ||
# parse args | ||
COMMAND="process_multi_updates" | ||
lines="-n 10" | ||
mode="batch" | ||
|
||
opt=0 | ||
while [[ "${opt}" -lt 5 && "$1" == "-"* ]] | ||
|
@@ -40,6 +41,7 @@ do | |
;; | ||
"-w"|"--watch") | ||
follow="-f" | ||
mode="webhook" | ||
shift | ||
;; | ||
"-n"|"--lines") | ||
|
@@ -61,8 +63,8 @@ file="${WEBHOOK}" | |
if [ -n "${startbot}" ]; then | ||
# warn when starting bot without pipe | ||
[ -p "${file}" ] || printf "%(%c)T: %b\n" -1 "${ORANGE}Warning${NC}: File is not a pipe:${GREY} ${file##*/}${NC}" | ||
start_bot "$2" "webhook" | ||
printf "%(%c)T: %b\n" -1 "${GREEN}Bot start actions done, start reading updates ....${NC}" | ||
start_bot "$2" "${mode}" | ||
printf "%(%c)T: %b\n" -1 "${GREEN}Bot startup actions done, start ${mode} updates ...${NC}" | ||
fi | ||
# check file exist | ||
if [[ ! -r "${file}" || -d "${file}" ]]; then | ||
|
@@ -74,14 +76,14 @@ fi | |
# ready, do stuff here ----- | ||
|
||
# kill all sub processes on exit | ||
trap 'kill $(jobs -p) 2>/dev/null; send_normal_message "'"${BOTADMIN}"'" "Bot '"${BOTNAME}"' webhook stopped ..."; printf "%(%c)T: %s\n" -1 "Bot in batch mode stopped!"' EXIT HUP QUIT | ||
trap 'printf "%(%c)T: %s\n" -1 "Bot in '"${mode}"' mode stopped"; kill $(jobs -p) 2>/dev/null; wait $(jobs -p) 2>/dev/null; send_normal_message "'"${BOTADMIN}"'" "Bot '"${BOTNAME} ${mode}"' stopped ..."' EXIT HUP QUIT | ||
|
||
# wait after (first) update to avoid processing to many in parallel | ||
UPDWAIT="0.5" | ||
# use tail to read appended updates | ||
# shellcheck disable=SC2086,SC2248 | ||
tail ${follow} ${lines} "${file}" |\ | ||
while IFS="" read -r input | ||
tail ${follow} ${lines} "${file}" 2>/dev/null |\ | ||
while IFS="" read -r input 2>/dev/null | ||
do | ||
# read json from stdin and convert update format | ||
# replace any ID named BOTADMIN with ID of bot admin | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ USAGE='process_update.sh [-h|--help] [debug] [<file]' | |
# AUTHOR: KayM (gnadelwartz), [email protected] | ||
# CREATED: 30.01.2021 19:14 | ||
# | ||
#### $$VERSION$$ v1.5-0-g8adca9b | ||
#### $$VERSION$$ v1.51-0-g6e66a28 | ||
#=============================================================================== | ||
|
||
#### | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ USAGE='promote_user.sh [-h|--help] "CHAT[ID]" "USER[ID]" "right[:true|false]" .. | |
# AUTHOR: KayM (gnadelwartz), [email protected] | ||
# CREATED: 25.01.2021 22:34 | ||
# | ||
#### $$VERSION$$ v1.5-0-g8adca9b | ||
#### $$VERSION$$ v1.51-0-g6e66a28 | ||
#=============================================================================== | ||
|
||
#### | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ USAGE='broadcast_message.sh [-h|--help] [--doit] [--groups|--both|--db=file] [fo | |
# AUTHOR: KayM (gnadelwartz), [email protected] | ||
# CREATED: 16.12.2020 16:14 | ||
# | ||
#### $$VERSION$$ v1.5-0-g8adca9b | ||
#### $$VERSION$$ v1.51-0-g6e66a28 | ||
#=============================================================================== | ||
|
||
#### | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ USAGE='send_message.sh [-h|--help] "CHAT[ID]" "message" "text|url" ...' | |
# AUTHOR: KayM (gnadelwartz), [email protected] | ||
# CREATED: 18.01.2021 11:34 | ||
# | ||
#### $$VERSION$$ v1.5-0-g8adca9b | ||
#### $$VERSION$$ v1.51-0-g6e66a28 | ||
#=============================================================================== | ||
|
||
#### | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,8 +9,8 @@ USAGE='send_dice.sh [-h|--help] "CHAT[ID]" "emoji" [debug]' | |
# DESCRIPTION: send an animated emoji (dice) to given chat | ||
# | ||
# OPTIONS: CHAT[ID] - ID number of CHAT or BOTADMIN to send to yourself | ||
# emoji - must be one of: “🎲”, “🎯”, “🏀”, “⚽”, or “🎰” | ||
# ":game_die:" ":dart:" ":basketball:" ":soccer:" :slot_machine:" | ||
# emoji - must be one of: “🎲”, “🎯”, “🏀”, “⚽” “🎰” "🎳" | ||
# :game_die: :dart: :basketball: :soccer: :slot_machine: :bowling: | ||
# | ||
# -h - display short help | ||
# --help - this help | ||
|
@@ -21,7 +21,7 @@ USAGE='send_dice.sh [-h|--help] "CHAT[ID]" "emoji" [debug]' | |
# AUTHOR: KayM (gnadelwartz), [email protected] | ||
# CREATED: 07.02.2021 18:45 | ||
# | ||
#### $$VERSION$$ v1.5-0-g8adca9b | ||
#### $$VERSION$$ v1.51-0-g6e66a28 | ||
#=============================================================================== | ||
|
||
#### | ||
|
Oops, something went wrong.