Merge pull request #193 from topkecleon/develop

Bashbot Version 1.52
This commit is contained in:
Kay Marquardt 2022-06-27 20:19:54 +02:00 committed by GitHub
commit 4591b357d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
84 changed files with 139 additions and 122 deletions

View File

@ -263,6 +263,6 @@ It features background tasks and interactive chats, and can serve as an interfac
<p>@Gnadelwartz</p>
<h2>That's it all guys!</h2>
<p>If you feel that there's something missing or if you found a bug, feel free to submit a pull request!</p>
<h4>$$VERSION$$ v1.51-0-g6e66a28</h4>
<h4>$$VERSION$$ v1.52-0-g1a83202</h4>
</body>
</html>

View File

@ -242,4 +242,4 @@ See `mycommnds.sh.dist` for an example.
If you feel that there's something missing or if you found a bug, feel free to submit a pull request!
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db

View File

@ -319,5 +319,5 @@ That's it all guys!
If you feel that there's something missing or if you found a bug, feel free to submit a
pull request!
$$VERSION$$ v1.51-0-g6e66a28
$$VERSION$$ v1.52-0-g1a83202

View File

@ -4,7 +4,7 @@
# this addon counts how many files, e.g. stickers, are sent to
# a chat and takes actions if threshold is reached
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
# used events:
#

View File

@ -4,7 +4,7 @@
# Addons can register to bashbot events at startup
# by providing their name and a callback per event
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
#
# If an event occurs each registered event function is called.
#

View File

@ -1,11 +1,11 @@
#!/bin/sh
#!/bin/bash
# description: Start or stop telegram-bash-bot
#
# example service script to run bashbot in background as specified user
#
# tested on: ubuntu, opensuse, debian
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
# shellcheck disable=SC2009
# shellcheck disable=SC2181
# shellcheck disable=SC2250
@ -59,32 +59,32 @@ hooklog="WEBHOOK"
# check for bot status
stat=""
ps -f -u "${runas}" | grep "${name}" | grep -qF "bashbot.sh startbot"
if [ "$?" = "0" ]; then
# printf "bashbot (%s) is running in poll mode\n" "${name}"
stat="poll"
stat="${stat} polling"
fi
ps -f -u "${runas}" | grep "${name}" | grep -qF "process_batch.sh --startbot"
if [ "$?" = "0" ]; then
#printf "bashbot (%s) is running in webhook mode\n" "${name}"
stat="${stat} webhook"
elif [ "${name}" != "unknown" ]; then
#printf "bashbot (%s) is stopped\n" "${name}"
stat="stop"
else
ps -f -u "${runas}" | grep "${name}" | grep -qF "process_batch.sh --startbot"
if [ "$?" = "0" ]; then
#printf "bashbot (%s) is running in webhook mode\n" "${name}"
stat="hook"
elif [ "${name}" != "unknown" ]; then
#printf "bashbot (%s) is stopped\n" "${name}"
stat="stop"
else
stat="unknown"
fi
stat="unknown"
fi
case "$1" in
'start')
[ "${stat}" != "stop" ] && printf "Warning, bot is running in mode: %s\n" "${stat}"
[ "${stat}" != "stop" ] && printf "Warning, bot is already running in mode: %s\n" "${stat}"
$runcmd "$bashbot start $mode" # >/dev/null 2>&1 </dev/null
RETVAL=$?
;;
'starthook')
[ -p "${FIFO}" ] || printf "Warning, webhook pipe not found: %s\n" "${FIFO##*/}"
[ "${stat}" != "stop" ] && printf "Warning, bot is running in mode: %s\n" "${stat}"
[ "${stat}" != "stop" ] && printf "Warning, bot is already running in mode: %s\n" "${stat}"
printf "Starting bashbot in webhook mode ... "
$runcmd "$webhook $mode </dev/null &>>${bashbotdir}/logs/${hooklog}.log &" # >/dev/null 2>&1 </dev/null
sleep 1
@ -92,16 +92,16 @@ case "$1" in
RETVAL=$?
;;
'stop')
[ "${stat}" != "poll" ] && printf "Warning, bot is not in poll mode: %s\n" "${stat}"
[[ "${stat}" != *"poll"* ]] && printf "Warning, bot is not in poll mode: %s\n" "${stat}"
$runcmd "$bashbot stop $mode"
RETVAL=$?
;;
'stophook')
[ "${stat}" != "hook" ] && printf "Warning, bot is not in webhook mode: %s\n" "${stat}"
[[ "${stat}" != *"hook"* ]] && printf "Warning, bot is not in webhook mode: %s\n" "${stat}"
printf "Stopping bashbot webhook mode ... "
KILLID="$(ps -f -u "${runas}" | grep "process_batch.sh --startbot" | sed -E 's/[^0-9]+([0-9]+).*/\1/' | tr -s "\r\n" " ")"
if [ -n "${KILLID}" ]; then
$runcmd "kill ${KILLID}; wait ${KILLID} 2>/dev/null"
$runcmd "kill ${KILLID} 2>/dev/null; wait ${KILLID} 2>/dev/null"
sleep 1
fi
RETVAL=$?
@ -109,13 +109,13 @@ case "$1" in
;;
'status')
case "${stat}" in
"poll"*) printf "bashbot (%s) is running in poll mode\n" "${name}"
*"poll"*) printf "bashbot (%s) is running in polling mode\n" "${name}"
RETVAL=0
;;&
*"hook"*) printf "bashbot (%s) is running in webhook mode\n" "${name}"
RETVAL=0
;;
"hook"*) printf "bashbot (%s) is running in webhook mode\n" "${name}"
RETVAL=0
;;
"stop"*) printf "bashbot (%s) is not running\n" "${name}"
*"stop"*) printf "bashbot (%s) is not running\n" "${name}"
RETVAL=1
;;
*) printf "bashbot (%s) status is %s\n" "${name}" "${stat}"
@ -137,7 +137,7 @@ case "$1" in
;;
'suspendback'|'resumeback'|'killback')
# shellcheck disable=SC2250
$runcmd "$bashbot $1 $mode"
$runcmd "$bashbot $1"
RETVAL=$?
# kill inotifywait from runuser
if [ "$1" != "resumeback" ]; then

View File

@ -30,7 +30,7 @@ BOTCOMMANDS="-h help init start stop status suspendback resumeback killb
# 8 - curl/wget missing
# 10 - not bash!
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
##################################################################
# are we running in a terminal?
@ -550,14 +550,14 @@ if detect_curl ; then
# $1 URL, $2 hack: log getJson if not ""
getJson(){
# shellcheck disable=SC2086
"${BASHBOT_CURL}" -sL -k ${BASHBOT_CURL_ARGS} -m "${TIMEOUT}" "$1"
"${BASHBOT_CURL}" -sL -k ${BASHBOT_CURL_ARGS} -m "${TIMEOUT}" -K - <<<"url=$1"
}
# curl variant for sendJson
# usage: "JSON" "URL"
sendJson_do(){
# shellcheck disable=SC2086
"${BASHBOT_CURL}" -s -k ${BASHBOT_CURL_ARGS} -m "${TIMEOUT}"\
-d "$1" -X POST "$2" -H "Content-Type: application/json" | "${JSONSHFILE}" -b -n 2>/dev/null
-d "$1" -X POST -K - <<<"url=$2" -H "Content-Type: application/json" | "${JSONSHFILE}" -b -n 2>/dev/null
}
#$1 Chat, $2 what, $3 file, $4 URL, $5 caption
sendUpload() {
@ -566,11 +566,11 @@ if detect_curl ; then
[ -n "${BASHBOTDEBUG}" ] &&\
log_update "sendUpload CHAT=$1 WHAT=$2 FILE=$3 CAPT=$5"
# shellcheck disable=SC2086
res="$("${BASHBOT_CURL}" -s -k ${BASHBOT_CURL_ARGS} "$4" -F "chat_id=$1"\
res="$("${BASHBOT_CURL}" -s -k ${BASHBOT_CURL_ARGS} -K - <<<"url=$4" -F "chat_id=$1"\
-F "$2=@$3;${3##*/}" -F "caption=$5" | "${JSONSHFILE}" -b -n 2>/dev/null )"
else
# shellcheck disable=SC2086
res="$("${BASHBOT_CURL}" -s -k ${BASHBOT_CURL_ARGS} "$4" -F "chat_id=$1"\
res="$("${BASHBOT_CURL}" -s -k ${BASHBOT_CURL_ARGS} -K - <<<"url=$4" -F "chat_id=$1"\
-F "$2=@$3;${3##*/}" | "${JSONSHFILE}" -b -n 2>/dev/null )"
fi
sendJsonResult "${res}" "sendUpload (curl)" "$@"
@ -581,14 +581,14 @@ else
if _exists wget; then
getJson(){
# shellcheck disable=SC2086
wget --no-check-certificate -t 2 -T "${TIMEOUT}" ${BASHBOT_WGET_ARGS} -qO - "$1"
wget --no-check-certificate -t 2 -T "${TIMEOUT}" ${BASHBOT_WGET_ARGS} -qO - -i <<<"$1"
}
# curl variant for sendJson
# usage: "JSON" "URL"
sendJson_do(){
# shellcheck disable=SC2086
wget --no-check-certificate -t 2 -T "${TIMEOUT}" ${BASHBOT_WGET_ARGS} -qO - --post-data="$1" \
--header='Content-Type:application/json' "$2" | "${JSONSHFILE}" -b -n 2>/dev/null
--header='Content-Type:application/json' -i <<<"$2" | "${JSONSHFILE}" -b -n 2>/dev/null
}
sendUpload() {
log_error "Sorry, wget does not support file upload"

View File

@ -21,7 +21,7 @@ USAGE='any_command.sh [-h|--help] [--force|--reference] bot_command args ...'
# AUTHOR: KayM (gnadelwartz), kay@rrr.de
# CREATED: 30.01.2021 10:24
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
#===============================================================================
####

View File

@ -13,7 +13,7 @@
# AUTHOR: KayM (gnadelwartz), kay@rrr.de
# CREATED: 18.12.2020 12:27
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
#===============================================================================
############

View File

@ -11,7 +11,7 @@
# AUTHOR: KayM (gnadelwartz), kay@rrr.de
# CREATED: 27.01.2021 13:42
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
#===============================================================================
# shellcheck disable=SC2059

View File

@ -17,7 +17,7 @@ USAGE='bashbot_stats.sh [-h|--help] [debug]'
# AUTHOR: KayM (gnadelwartz), kay@rrr.de
# CREATED: 23.12.2020 20:34
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
#===============================================================================
# set bashbot environment

View File

@ -20,7 +20,7 @@ USAGE='delete_message.sh [-h|--help] "CHAT[ID]" "MESSAGE[ID]" [debug]'
# AUTHOR: KayM (gnadelwartz), kay@rrr.de
# CREATED: 03.01.2021 15:37
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
#===============================================================================
####

View File

@ -26,7 +26,7 @@ USAGE='send_message.sh [-h|--help] "CHAT[ID]" "MESSAGE[ID]" "text|url" ...'
# AUTHOR: KayM (gnadelwartz), kay@rrr.de
# CREATED: 21.01.2021 08:10
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
#===============================================================================
####

View File

@ -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.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
#===============================================================================
####

View File

@ -20,7 +20,7 @@ USAGE='kickban_user.sh [-h|--help] [-u|--unban] "CHAT[ID]" "USER[ID]" [debug]'
# AUTHOR: KayM (gnadelwartz), kay@rrr.de
# CREATED: 25.01.2021 20:34
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
#===============================================================================
####

View File

@ -21,7 +21,7 @@ USAGE='process_batch.sh [-h|--help] [-s|--startbot] [-w|--watch] [-n|--lines n]
# AUTHOR: KayM (gnadelwartz), kay@rrr.de
# CREATED: 27.02.2021 13:14
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
#===============================================================================
####

View File

@ -15,7 +15,7 @@ USAGE='process_update.sh [-h|--help] [debug] [<file]'
# AUTHOR: KayM (gnadelwartz), kay@rrr.de
# CREATED: 30.01.2021 19:14
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
#===============================================================================
####

View File

@ -25,7 +25,7 @@ USAGE='promote_user.sh [-h|--help] "CHAT[ID]" "USER[ID]" "right[:true|false]" ..
# AUTHOR: KayM (gnadelwartz), kay@rrr.de
# CREATED: 25.01.2021 22:34
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
#===============================================================================
####

View File

@ -28,7 +28,7 @@ USAGE='broadcast_message.sh [-h|--help] [--doit] [--groups|--both|--db=file] [fo
# AUTHOR: KayM (gnadelwartz), kay@rrr.de
# CREATED: 16.12.2020 16:14
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
#===============================================================================
####

View File

@ -26,7 +26,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.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
#===============================================================================
####

View File

@ -21,7 +21,7 @@ USAGE='send_dice.sh [-h|--help] "CHAT[ID]" "emoji" [debug]'
# AUTHOR: KayM (gnadelwartz), kay@rrr.de
# CREATED: 07.02.2021 18:45
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
#===============================================================================
####

View File

@ -25,7 +25,7 @@ USAGE='send_file.sh [-h|--help] "CHAT[ID]" "file|URL" "caption ...." [type] [deb
# AUTHOR: KayM (gnadelwartz), kay@rrr.de
# CREATED: 25.12.2020 20:24
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
#===============================================================================
####

View File

@ -8,11 +8,15 @@ USAGE='send_message.sh [-h|--help] [format] "CHAT[ID]" "message ...." [debug]'
#
# DESCRIPTION: send a message to the given user/group
#
# OPTIONS: format - normal, markdown, html (optional)
# OPTIONS: format - normal, markdown, html, stdin, - (optional)
# CHAT[ID] - ID number of CHAT or BOTADMIN to send to yourself
# message - message to send in specified format
# if no format is givern send_message() format is used
#
# use format "stdin" to read message from stdin or from a file:
# send_message.sh stdin "CHAT[ID]" <file
# df -h | send_message.sh - "CHAT[ID]"
#
# -h - display short help
# --help - this help
#
@ -22,7 +26,7 @@ USAGE='send_message.sh [-h|--help] [format] "CHAT[ID]" "message ...." [debug]'
# AUTHOR: KayM (gnadelwartz), kay@rrr.de
# CREATED: 16.12.2020 11:34
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
#===============================================================================
####
@ -41,6 +45,10 @@ case "$1" in
SEND="send_html_message"
shift
;;
"stdin"|"-")
FILE="stdin"
shift
;;
esac
# set bashbot environment
@ -56,7 +64,10 @@ else
fi
# send message in selected format
"${SEND}" "${CHAT}" "$2"
if [ "${FILE}" = "stdin" ]; then
"${SEND}" "${CHAT}" "$(cat)"
else
"${SEND}" "${CHAT}" "$2"
fi
# output send message result
print_result

View File

@ -15,7 +15,7 @@
# This file is public domain in the USA and all free countries.
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
#
# bashbot locale defaults to c.UTF-8, adjust locale in mycommands.sh if needed

View File

@ -5,7 +5,7 @@
#
# Description: run all tests, exit after failed test
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
#############################################################
#shellcheck disable=SC1090

View File

@ -5,7 +5,7 @@
#
# Description: common stuff for all dev scripts
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
#############################################################
# magic to ensure that we're always inside the root of our application,

View File

@ -3,7 +3,7 @@
#
# works together with git pre-push.sh and ADD all changed files since last push
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
#shellcheck disable=SC1090
source "${0%/*}/dev.inc.sh"

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
############
# NOTE: you MUST run install-hooks.sh again when updating this file!

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
############
# NOTE: you MUST run install-hooks.sh again when updating this file!

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
############
# NOTE: you MUST run install-hooks.sh again when updating this file!

View File

@ -7,7 +7,7 @@
#
# Usage: source inject-json.sh
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
##############################################################
# download JSON.sh

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash
# this has to run once atfer git clone
# and every time we create new hooks
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
#shellcheck disable=SC1090
source "${0%/*}/dev.inc.sh"

View File

@ -7,7 +7,7 @@
#
# Options: --notest - skip tests
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
##############################################################
#shellcheck disable=SC1090

View File

@ -7,7 +7,7 @@
#
# Usage: source make-hmtl
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
##############################################################
# check for correct dir

View File

@ -11,7 +11,7 @@
# If you your bot is finished you can use make-standalone.sh to create the
# the old all-in-one bashbot: bashbot.sh and commands.sh only!
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
###################################################################
# include git config and change to base dir

View File

@ -2,7 +2,7 @@
#
# joke hack to obfuscate bashbot.min.sh
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
# shellcheck disable=SC2028,SC2016,SC1117
infile="bashbot.sh"

View File

@ -1,5 +1,5 @@
# list of additional files to check from shellcheck
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
bashbot.rc
mycommands.conf
mycommands.sh.clean

View File

@ -1,6 +1,6 @@
#!/bin/bash
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
# shellcheck disable=SC2016
#
# Easy Versioning in git:

View File

@ -132,5 +132,5 @@ You must update to [Version 1.20](https://github.com/topkecleon/telegram-bot-bas
#### [Next Create Bot](1_firstbot.md)
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db

View File

@ -65,5 +65,5 @@ group. This step is up to you actually.
#### [Prev Installation](0_install.md)
#### [Next Getting started](2_usage.md)
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db

View File

@ -392,5 +392,5 @@ send_action "${CHAT[ID]}" "action"
#### [Prev Create Bot](1_firstbot.md)
#### [Next Advanced Usage](3_advanced.md)
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db

View File

@ -302,5 +302,5 @@ Note: If you disable automatic retry, se above, you disable also connection prob
#### [Prev Getting started](2_usage.md)
#### [Next Expert Use](4_expert.md)
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db

View File

@ -434,5 +434,5 @@ for every poll until the maximum of BASHBOT_SLEEP ms.
#### [Prev Advanced Use](3_advanced.md)
#### [Next Best Practice](5_practice.md)
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db

View File

@ -160,5 +160,5 @@ The second warning is about an unused variable, this is true because in our exam
#### [Prev Best Practice](5_practice.md)
#### [Next Functions Reference](6_reference.md)
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db

View File

@ -1673,5 +1673,5 @@ The name of your bot is available as bash variable "$ME", there is no need to ca
#### [Prev Best Practice](5_practice.md)
#### [Next Notes for Developers](7_develop.md)
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db

View File

@ -387,5 +387,5 @@ fi
#### [Prev Function Reference](6_reference.md)
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db

View File

@ -60,6 +60,6 @@ plus use of keyboards in private chats. It's an extended version of mycommands.s
**Webhook** contains instructions on how use webhook API to get updates from telegram instead polling Telegram server.
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db

View File

@ -4,7 +4,7 @@
#
# This file is public domain in the USA and all free countries.
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
######
# parameters

View File

@ -2,7 +2,7 @@
# file: run_filename
# background job to display content of all new files in WATCHDIR
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
######
# parameters

View File

@ -2,7 +2,7 @@
# file: run_filename
# background job to display all new files in WATCHDIR
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
######
# parameters

View File

@ -4,7 +4,7 @@
#
# This file is public domain in the USA and all free countries.
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
######
# parameters

View File

@ -6,7 +6,7 @@
# This file is public domain in the USA and all free countries.
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
# shellcheck disable=SC1117
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
# adjust your language setting here
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment

View File

@ -2,7 +2,7 @@
# file. multibot.sh
# description: run multiple telegram bots from one installation
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
if [ "$2" = "" ] || [ "$2" = "-h" ]; then
echo "Usage: $0 botname command"

View File

@ -7,7 +7,7 @@
# This file is public domain in the USA and all free countries.
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
SHELL=/bin/sh

View File

@ -11,7 +11,7 @@
# This file is public domain in the USA and all free countries.
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
########################################################################
######

View File

@ -10,7 +10,7 @@
# AUTHOR: KayM (), kay@rrr.de
# DATE: 19.12.2020 19:03
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
#===============================================================================
# shellcheck disable=SC2154
# shellcheck disable=SC2034

View File

@ -13,7 +13,7 @@
# This file is public domain in the USA and all free countries.
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
########################################################################
######

View File

@ -10,7 +10,7 @@
# This file is public domain in the USA and all free countries.
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
########################################################################
######

View File

@ -1,7 +1,7 @@
# file: botacl
# a user not listed here, will return false from 'user_is_allowed'
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
# Format:
# user:resource:chat

View File

@ -5,7 +5,7 @@
# to show how you can customize bashbot by only editing mycommands.sh
# NOTE: this is not tested, simply copied from original source and reworked!
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
#
# shellcheck disable=SC2154
# shellcheck disable=SC2034

View File

@ -96,5 +96,5 @@ webhook updates only over secure TLS connections with a valid SSL certificate ch
`socat` looks like a tool to listen for Telegram updates from bash scripts, let's see ...
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db

View File

@ -11,7 +11,7 @@
* @license http://www.wtfpl.net/txt/copying/ WTFPLv2
* @since 30.01.2021 20:24
*
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
***********************************************************/
// bashbot home dir

View File

@ -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$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
#
# will be automatically sourced from bashbot

View File

@ -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$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
# will be automatically sourced from bashbot

View File

@ -6,7 +6,7 @@
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
#
# shellcheck disable=SC1117,SC2059
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
# will be automatically sourced from bashbot

View File

@ -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$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
# will be automatically sourced from bashbot
@ -73,11 +73,11 @@ chat_member_count() {
}
kick_chat_member() {
sendJson "$1" 'user_id: '"$2"'' "${URL}/kickChatMember"
sendJson "$1" '"user_id": '"$2"'' "${URL}/kickChatMember"
}
unban_chat_member() {
sendJson "$1" 'user_id: '"$2"'' "${URL}/unbanChatMember"
sendJson "$1" '"user_id": '"$2"'' "${URL}/unbanChatMember"
}
leave_chat() {

View File

@ -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$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
#
# source from commands.sh to use jsonDB functions
#

View File

@ -4,7 +4,7 @@
# File: processUpdates.sh
# Note: DO NOT EDIT! this file will be overwritten on update
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
##################################################################
##############

View File

@ -6,7 +6,7 @@
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
#
# shellcheck disable=SC1117
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
# will be automatically sourced from bashbot
@ -144,6 +144,12 @@ send_keyboard() {
text="$(JsonEscape "$2")"
text='"text":"'"${text//$'\n'/\\n}"'"'
fi
# text longer than 4096, send text and keyboard separate
if [ "${#2}" -gt 4096 ]; then
send_normal_message "$1" "$2"
send_keyboard "$1" "..." "$3"
return
fi
local one_time=', "one_time_keyboard":true' && [ -n "$4" ] && one_time=""
# '"text":"$2", "reply_markup": {"keyboard": [ $3 ], "one_time_keyboard": true}'
sendJson "$1" "${text}"', "reply_markup": {"keyboard": [ '"$3"' ] '"${one_time}"'}' "${MSG_URL}"

View File

@ -12,7 +12,7 @@
# Author: KayM (gnadelwartz), kay@rrr.de
# Created: 09.01.2021 07:27
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
#######################################################
##########

View File

@ -13,7 +13,7 @@
# License: WTFPLv2 http://www.wtfpl.net/txt/copying/
# Author: KayM (gnadelwartz), kay@rrr.de
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
#######################################################
# shellcheck disable=SC1117
@ -327,13 +327,13 @@ else
local user="$4"; [[ -z "$4" && -n "$3" ]] && user="$3"
if [ -n "${user}" ]; then
# block chat/user
case "$6" in
case "$5" in
*"blocked"*)
jssh_insertKeyDB "${user}" "User blocked bot on (LANG=C date)" "${BLOCKEDFILE}";;
jssh_insertKeyDB "${user}" "User blocked bot on $(LANG=C date)" "${BLOCKEDFILE}";;
*"kicked"*)
jssh_insertKeyDB "${user}" "Bot kicked from chat on (LANG=C date)" "${BLOCKEDFILE}";;
jssh_insertKeyDB "${user}" "Bot kicked from chat on $(LANG=C date)" "${BLOCKEDFILE}";;
*)
jssh_insertKeyDB "${user}" "Reason: $6 on (LANG=C date)" "${BLOCKEDFILE}";;
jssh_insertKeyDB "${user}" "Reason: $6 on $(LANG=C date)" "${BLOCKEDFILE}";;
esac
fi
}

View File

@ -10,7 +10,7 @@
# License: WTFPLv2 http://www.wtfpl.net/txt/copying/
# Author: KayM (gnadelwartz), kay@rrr.de
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
#######################################################
# shellcheck disable=SC1117

View File

@ -12,7 +12,7 @@
# This file is public domain in the USA and all free countries.
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
########################################################################
######

View File

@ -10,7 +10,7 @@
# LICENSE: WTFPLv2 http://www.wtfpl.net/txt/copying/
# AUTHOR: KayM (gnadelwartz), kay@rrr.de
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
#===============================================================================
# magic to ensure that we're always inside the root of our application,

View File

@ -11,7 +11,7 @@
# LICENSE: WTFPLv2 http://www.wtfpl.net/txt/copying/
# AUTHOR: KayM (gnadelwartz), kay@rrr.de
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
#===============================================================================
# common variables

View File

@ -10,7 +10,7 @@
# LICENSE: WTFPLv2 http://www.wtfpl.net/txt/copying/
# AUTHOR: KayM (gnadelwartz), kay@rrr.de
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
#===============================================================================
../dev/hooks/pre-commit.sh

View File

@ -10,7 +10,7 @@
# LICENSE: WTFPLv2 http://www.wtfpl.net/txt/copying/
# AUTHOR: KayM (gnadelwartz), kay@rrr.de
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
#===============================================================================
# include common functions and definitions

View File

@ -10,7 +10,7 @@
# LICENSE: WTFPLv2 http://www.wtfpl.net/txt/copying/
# AUTHOR: KayM (gnadelwartz), kay@rrr.de
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
#===============================================================================
# include common functions and definitions

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
# include common functions and definitions
# shellcheck source=test/ALL-tests.inc.sh

View File

@ -10,7 +10,7 @@
# LICENSE: WTFPLv2 http://www.wtfpl.net/txt/copying/
# AUTHOR: KayM (gnadelwartz), kay@rrr.de
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
#===============================================================================
# include common functions and definitions

View File

@ -10,7 +10,7 @@
# LICENSE: WTFPLv2 http://www.wtfpl.net/txt/copying/
# AUTHOR: KayM (gnadelwartz), kay@rrr.de
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
#===============================================================================
# include common functions and definitions

View File

@ -10,7 +10,7 @@
# LICENSE: WTFPLv2 http://www.wtfpl.net/txt/copying/
# AUTHOR: KayM (gnadelwartz), kay@rrr.de
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
#===============================================================================
# include common functions and definitions

View File

@ -10,7 +10,7 @@
# LICENSE: WTFPLv2 http://www.wtfpl.net/txt/copying/
# AUTHOR: KayM (gnadelwartz), kay@rrr.de
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
#===============================================================================
# include common functions and definitions

View File

@ -10,7 +10,7 @@
# LICENSE: WTFPLv2 http://www.wtfpl.net/txt/copying/
# AUTHOR: KayM (gnadelwartz), kay@rrr.de
#
#### $$VERSION$$ v1.51-6-g6490f67
#### $$VERSION$$ v1.52-1-g0dae2db
#===============================================================================
# include common functions and definitions