mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2024-12-27 20:44:53 +00:00
0.80-pre, adjust doc, convert echo with parameters to fprint
This commit is contained in:
parent
dd7c66d823
commit
b8ae9eca87
@ -107,6 +107,6 @@
|
||||
<p><span class="citation">@Gnadelwartz</span></p>
|
||||
<h2 id="thats-it">That’s it!</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 id="version-v0.80-dev3-5-g83623ec"><br /><span class="math display"><em>V</em><em>E</em><em>R</em><em>S</em><em>I</em><em>O</em><em>N</em></span><br /> v0.80-dev3-5-g83623ec</h4>
|
||||
<h4 id="version-v0.80-pre-0-gdd7c66d"><br /><span class="math display"><em>V</em><em>E</em><em>R</em><em>S</em><em>I</em><em>O</em><em>N</em></span><br /> v0.80-pre-0-gdd7c66d</h4>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -106,4 +106,4 @@ Well, thats a damn good question ... may be because I'm an Unix/Linux admin from
|
||||
|
||||
If you feel that there's something missing or if you found a bug, feel free to submit a pull request!
|
||||
|
||||
#### $$VERSION$$ v0.80-dev3-5-g83623ec
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
|
@ -154,4 +154,4 @@ health status
|
||||
If you feel that there's something missing or if you found a bug, feel free to
|
||||
submit a pull request!
|
||||
|
||||
#### $$VERSION$$ v0.80-dev3-5-g83623ec
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
# description: Start or stop telegram-bash-bot
|
||||
#
|
||||
#### $$VERSION$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
# shellcheck disable=SC2009
|
||||
# shellcheck disable=SC2181
|
||||
|
||||
|
26
bashbot.sh
26
bashbot.sh
@ -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$$ v0.80-dev3-6-gbeb77a4
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
#
|
||||
# Exit Codes:
|
||||
# - 0 sucess (hopefully)
|
||||
@ -62,7 +62,7 @@ if [ ! -f "${TOKENFILE}" ]; then
|
||||
echo -e "${RED}TOKEN MISSING.${NC}"
|
||||
echo -e "${ORANGE}PLEASE WRITE YOUR TOKEN HERE OR PRESS CTRL+C TO ABORT${NC}"
|
||||
read -r token
|
||||
echo "${token}" > "${TOKENFILE}"
|
||||
printf '%s\n' "${token}" > "${TOKENFILE}"
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -70,22 +70,22 @@ BOTADMIN="${BASHBOT_ETC:-.}/botadmin"
|
||||
if [ ! -f "${BOTADMIN}" ]; then
|
||||
if [ "${CLEAR}" = "" ]; then
|
||||
echo "Running headless, set botadmin to AUTO MODE!"
|
||||
echo '?' > "${BOTADMIN}"
|
||||
printf '%s\n' '?' > "${BOTADMIN}"
|
||||
else
|
||||
${CLEAR}
|
||||
echo -e "${RED}BOTADMIN MISSING.${NC}"
|
||||
echo -e "${ORANGE}PLEASE WRITE YOUR TELEGRAM ID HERE OR ENTER '?'${NC}"
|
||||
echo -e "${ORANGE}TO MAKE FIRST USER TYPING '/start' TO BOTADMIN${NC}"
|
||||
read -r token
|
||||
echo "${token}" > "${BOTADMIN}"
|
||||
[ "${token}" = "" ] && echo '?' > "${BOTADMIN}"
|
||||
read -r admin
|
||||
printf '%S\n' "${admin}" > "${BOTADMIN}"
|
||||
[ "${admin}" = "" ] && printf '%s\n' '?' > "${BOTADMIN}"
|
||||
fi
|
||||
fi
|
||||
|
||||
BOTACL="${BASHBOT_ETC:-.}/botacl"
|
||||
if [ ! -f "${BOTACL}" ]; then
|
||||
echo -e "${ORANGE}Create empty ${BOTACL} file.${NC}"
|
||||
echo "" >"${BOTACL}"
|
||||
printf '\n' >"${BOTACL}"
|
||||
fi
|
||||
|
||||
TMPDIR="${BASHBOT_VAR:-.}/data-bot-bash"
|
||||
@ -99,7 +99,7 @@ fi
|
||||
|
||||
COUNTFILE="${BASHBOT_VAR:-.}/count"
|
||||
if [ ! -f "${COUNTFILE}" ]; then
|
||||
echo "" >"${COUNTFILE}"
|
||||
printf '\n' >"${COUNTFILE}"
|
||||
elif [ ! -w "${COUNTFILE}" ]; then
|
||||
echo -e "${RED}ERROR: Can't write to ${COUNTFILE}!.${NC}"
|
||||
ls -l "${COUNTFILE}"
|
||||
@ -135,7 +135,7 @@ fi
|
||||
# $1 postfix, e.g. chatid
|
||||
# $2 prefix, back- or startbot-
|
||||
procname(){
|
||||
echo "$2${ME}_$1"
|
||||
printf '%s\n' "$2${ME}_$1"
|
||||
}
|
||||
|
||||
# $1 proc name
|
||||
@ -262,7 +262,7 @@ process_client() {
|
||||
# shellcheck source=./commands.sh
|
||||
source "${COMMANDS}" "${debug}"
|
||||
tmpcount="COUNT${CHAT[ID]}"
|
||||
grep -q "$tmpcount" <"${COUNTFILE}" >/dev/null 2>&1 || cat <<< "$tmpcount" >>"${COUNTFILE}"
|
||||
grep -q "$tmpcount" <"${COUNTFILE}" &>/dev/null || cat <<< "$tmpcount" >>"${COUNTFILE}"
|
||||
# To get user count execute bash bashbot.sh count
|
||||
}
|
||||
process_inline() {
|
||||
@ -329,8 +329,8 @@ process_message() {
|
||||
URLS[VOICE]="$(get_file "$(JsonGetString '"result",'"${num}"',"message","voice","file_id"' <"$TMP")")"
|
||||
|
||||
# Contact
|
||||
CONTACT[USER_ID]="$(JsonDecode "$(JsonGetString '"result",'"${num}"',"message","contact","user_id"' <"$TMP")")"
|
||||
CONTACT[FIRST_NAME]="$(JsonDecode "$(JsonGetString '"result",'"${num}"',"message","contact","first_name"' <"$TMP")")"
|
||||
CONTACT[USER_ID]="$(JsonDecode "$(JsonGetString '"result",'"${num}"',"message","contact","user_id"' <"$TMP")")"
|
||||
CONTACT[LAST_NAME]="$(JsonDecode "$(JsonGetString '"result",'"${num}"',"message","contact","last_name"' <"$TMP")")"
|
||||
CONTACT[NUMBER]="$(JsonGetString '"result",'"${num}"',"message","contact","phone_number"' <"$TMP")"
|
||||
CONTACT[VCARD]="$(JsonGetString '"result",'"${num}"',"message","contact","vcard"' <"$TMP")"
|
||||
@ -393,13 +393,13 @@ bot_init() {
|
||||
[ -f "modules/inline.sh" ] && rm -f "modules/inline.sh"
|
||||
# shellcheck disable=SC2009
|
||||
oldbot="$(ps -ef | grep startbot | grep -v -e 'grep' -e '\-startbot' )"
|
||||
[ "${oldbot}" != "" ] && echo -e "${ORANGE}Warning: Old TMUX bot is running! You must kill it manually first:${NC}\\n$${oldbot}" && exit 5
|
||||
[ "${oldbot}" != "" ] && echo -e "${ORANGE}Warning: Old TMUX bot is running! You must kill it manually first:${NC}\\n${oldbot}"
|
||||
#setup bashbot
|
||||
[[ "${UID}" -eq "0" ]] && RUNUSER="nobody"
|
||||
echo -n "Enter User to run basbot [$RUNUSER]: "
|
||||
read -r TOUSER
|
||||
[ "$TOUSER" = "" ] && TOUSER="$RUNUSER"
|
||||
if ! id "$TOUSER" >/dev/null 2>&1; then
|
||||
if ! id "$TOUSER" &>/dev/null; then
|
||||
echo -e "${RED}User \"$TOUSER\" not found!${NC}"
|
||||
exit 3
|
||||
else
|
||||
|
@ -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$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
#
|
||||
|
||||
# adjust your language setting here, e.g.when run from other user or cron.
|
||||
@ -107,7 +107,7 @@ if [ "${1}" != "source" ];then
|
||||
if [ "$res" -eq 0 ] ; then killproc && _message "Command canceled.";else _message "No command is currently running.";fi
|
||||
;;
|
||||
*) # forward messages to optional dispatcher
|
||||
_is_function forward_interactive && forward_interactive "${CHAT[ID]}" "${MESSAGE}" # interactive running
|
||||
_is_function send_interactive && send_interactive "${CHAT[ID]}" "${MESSAGE}"
|
||||
_is_function mycommands && mycommands
|
||||
;;
|
||||
esac
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
# this has to run once atfer git clone
|
||||
# and every time we create new hooks
|
||||
#### $$VERSION$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
|
||||
# magic to ensure that we're always inside the root of our application,
|
||||
# no matter from which directory we'll run script
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
# works together with git pre-push.sh and ADD all changed files since last push
|
||||
|
||||
#### $$VERSION$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
|
||||
# magic to ensure that we're always inside the root of our application,
|
||||
# no matter from which directory we'll run script
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#### $$VERSION$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
|
||||
############
|
||||
# NOTE: you MUST run install-hooks.sh again when updating this file!
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#### $$VERSION$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
|
||||
############
|
||||
# NOTE: you MUST run install-hooks.sh again when updating this 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$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
|
||||
# magic to ensure that we're always inside the root of our application,
|
||||
# no matter from which directory we'll run script
|
||||
|
@ -2,7 +2,7 @@
|
||||
# file: make-distribution.sh
|
||||
# creates files and arcchives to dirtribute bashbot
|
||||
#
|
||||
#### $$VERSION$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
|
||||
# magic to ensure that we're always inside the root of our application,
|
||||
# no matter from which directory we'll run script
|
||||
|
@ -5,7 +5,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$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
|
||||
# magic to ensure that we're always inside the root of our application,
|
||||
# no matter from which directory we'll run script
|
||||
|
@ -1,3 +1,3 @@
|
||||
# list of additional files to check from shellcheck
|
||||
#### $$VERSION$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
bashbot.rc
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
#### $$VERSION$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
# shellcheck disable=SC2016
|
||||
#
|
||||
# Easy Versioning in git:
|
||||
|
@ -35,19 +35,34 @@ As an alternative to download the zip files, you can clone the github repository
|
||||
3. Extract all files to your existing bashbot dir
|
||||
**Note: all files execpt 'mycommands.sh' and 'commands.sh' may overwritten!**
|
||||
4. Save your your current 'commands.sh' and run ```cp commands.sh.dist commands.sh```
|
||||
5. Run ```sudo ./bashbot.sh init``` to setup your environment after the update
|
||||
5. Stop all running instances of bashbot at this point latest
|
||||
6. Run ```sudo ./bashbot.sh init``` to setup your environment after the update
|
||||
|
||||
If you modified 'commands.sh' re apply all changes to the new 'commands.sh'. To avoid this all your modifications
|
||||
must be done in 'mycommands.sh' only.
|
||||
|
||||
Now you can restart your bashbot instances.
|
||||
|
||||
### Notes on Updates
|
||||
|
||||
#### Location of tmp / data dir
|
||||
From version 0.70 on the tmp dir is renamed to 'data-bot-bash' to reflect the fact that not only temporary files are stored. an existing 'tmp-bot-bash' will be automatically renamed after update.
|
||||
#### removal of TMUX
|
||||
From version 0.80 on TMUX is no longer needed and the bachsbot command 'attach' is deleted. Old function 'inproc'
|
||||
is replaced by 'send_interactive'. send_interactive does checks if an interactive job is running internaly.
|
||||
Pls check if you make use of inproc and remove it including the old checks, e.g.
|
||||
```bash
|
||||
if tmux ls | grep -v send | grep -q "$copname"; then inproc; fi
|
||||
# or
|
||||
[ checkprog ] && inproc
|
||||
```
|
||||
must be replaced by ```send_interactive "${CHATD[ID]}" "${MESSAGE}"```
|
||||
|
||||
### Do not edit commands.sh
|
||||
From version 0.60 on your commands must be placed in 'mycommands.sh'. If you update from a version with your commands
|
||||
in 'commands.sh' move all your commands and functions to 'mycommands.sh'.
|
||||
|
||||
#### Location of var / tmp / data dirs
|
||||
From version 0.70 on the tmp dir is renamed to 'data-bot-bash' to reflect the fact that not only temporary files are stored. an existing 'tmp-bot-bash' will be automatically renamed after update.
|
||||
|
||||
From version 0.50 on the temporary files are no more placed in '/tmp'. instead a dedicated tmp dir is used.
|
||||
|
||||
#### Changes to send_keyboard in v0.6
|
||||
@ -70,5 +85,5 @@ The old format is supported for backward compatibility, but may fail for corner
|
||||
|
||||
#### [Next Create Bot](1_firstbot.md)
|
||||
|
||||
#### $$VERSION$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
|
||||
|
@ -65,5 +65,5 @@ group. This step is up to you actually.
|
||||
#### [Prev Installation](0_install.md)
|
||||
#### [Next Getting started](2_usage.md)
|
||||
|
||||
#### $$VERSION$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
|
||||
|
@ -182,5 +182,5 @@ send_action "${CHAT[ID]}" "action"
|
||||
#### [Prev Create Bot](1_firstbot.md)
|
||||
#### [Next Advanced Usage](3_advanced.md)
|
||||
|
||||
#### $$VERSION$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
|
||||
|
@ -180,5 +180,5 @@ See also [answer_inline_multi, answer_inline_compose](6_reference.md#answer_inli
|
||||
#### [Prev Getting started](2_usage.md)
|
||||
#### [Next Expert Use](4_expert.md)
|
||||
|
||||
#### $$VERSION$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
|
||||
|
@ -104,5 +104,5 @@ An example crontab is provided in ```examples/bashbot.cron```.
|
||||
#### [Prev Expert Use](4_expert.md)
|
||||
#### [Next Best Practice](5_practice.md)
|
||||
|
||||
#### $$VERSION$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
|
||||
|
@ -153,5 +153,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$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
|
||||
|
@ -84,6 +84,17 @@ See also [deleteMessage limitations](https://core.telegram.org/bots/api#deleteme
|
||||
|
||||
----
|
||||
|
||||
##### send_message
|
||||
```send_message``` sends any type of message to the given chat. Type of output is steered by keywords within the message.
|
||||
|
||||
The main use case for send_message is to process the output of interactive chats and background jobs. **For regular Bot commands I recommend using of the dedicated send_xxx_message() functions from above.**
|
||||
|
||||
*usage:* send_message "${CHAT[ID]}" "message"
|
||||
|
||||
*example:* - see [Usage](2_usage.md#send_message) and [Advanced Usage](3_advanced.md#Interactive-Chats)
|
||||
|
||||
----
|
||||
|
||||
### File, Location, Venue, Keyboard
|
||||
|
||||
|
||||
@ -335,13 +346,14 @@ You must include ```source modules/background.sh``` in 'commands.sh' to have th
|
||||
|
||||
*usage:* start_proc "${CHAT[ID]}" "script"
|
||||
|
||||
*alias:* startproc "${CHAT[ID]}" "script"
|
||||
*alias:* startproc "script"
|
||||
|
||||
*example:*
|
||||
```bash
|
||||
startproc 'examples/calc.sh'
|
||||
```
|
||||
|
||||
|
||||
##### check_proc
|
||||
Return true (0) if an interactive script is running in the chat.
|
||||
|
||||
@ -351,8 +363,7 @@ Return true (0) if an interactive script is running in the chat.
|
||||
|
||||
*example:*
|
||||
```bash
|
||||
checkproc
|
||||
if [ "$res" -gt 0 ] ; then
|
||||
if ! check_proc "${CHAT[ID]}" ; then
|
||||
startproc "examples/calc.sh"
|
||||
else
|
||||
send_normal_message "${CHAT[ID]}" "Calc already running ..."
|
||||
@ -368,8 +379,7 @@ Kill the interactive script running in the chat
|
||||
|
||||
*example:*
|
||||
```bash
|
||||
checkprog
|
||||
if [ "$res" -eq 0 ]; then
|
||||
if check_proc "${CHAT[ID]}" ; then
|
||||
killproc && send_message "${CHAT[ID]}" "Command canceled."
|
||||
else
|
||||
send_message "${CHAT[ID]}" "Command is not running."
|
||||
@ -401,8 +411,7 @@ Return true (0) if an background job is active in the given chat.
|
||||
|
||||
*example:*
|
||||
```bash
|
||||
checkback "notify"
|
||||
if [ "$res" -gt 0 ] ; then
|
||||
if ! checkback "notify" ; then
|
||||
send_normal_message "${CHAT[ID]}" "Start notify"
|
||||
background "examples/notify.sh" "notify"
|
||||
else
|
||||
@ -429,16 +438,13 @@ fi
|
||||
|
||||
----
|
||||
|
||||
##### send_message
|
||||
```send_message``` sends any type of message to the given chat. Type of output is steered by keywords within the message.
|
||||
##### send_interactive
|
||||
Form version 0.80 on forward_message is used to forward messages to interactive job. It replaces the old 'inproc' commands used for TMUX.
|
||||
Usually message is automatically forwarded in 'commands.sh', but you can forward messages wihle processing also or send your own messages.
|
||||
|
||||
The main use case for send_message is to process the output of interactive chats and background jobs. **For regular Bot commands I recommend using of the dedicated send_xxx_message() functions from above.**
|
||||
*usage:* send_interactive "${CHAT[ID]}" "message"
|
||||
|
||||
*usage:* send_message "${CHAT[ID]}" "message"
|
||||
|
||||
*example:* - see [Usage](2_usage.md#send_message) and [Advanced Usage](3_advanced.md#Interactive-Chats)
|
||||
|
||||
----
|
||||
*replaces:*' incproc
|
||||
|
||||
### Aliases - shortcuts for often used funtions
|
||||
You must include ```source modules/aliases.sh``` in 'commands.sh' to have the following functions availible.
|
||||
@ -565,7 +571,7 @@ _is_function "background" && _message "you can run background jobs!"
|
||||
These functions are for internal use only and must not used in your bot commands.
|
||||
|
||||
##### procname
|
||||
Returns PrefixBotname-Postfix
|
||||
Returns PrefixBotname_Postfix
|
||||
|
||||
*usage:* procname postfix prefix
|
||||
|
||||
@ -620,11 +626,8 @@ The name of your bot is availible as bash variable "$ME", there is no need to ca
|
||||
|
||||
*usage:* ME="$(getBotNiname)"
|
||||
|
||||
##### inproc
|
||||
Send Input from Telegram to waiting Interactive Chat.
|
||||
|
||||
#### [Prev Best Practice](5_practice.md)
|
||||
#### [Next Notes for Developers](7_develop.md)
|
||||
|
||||
#### $$VERSION$$ v0.80-dev3-7-g7190c6e
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
|
||||
|
@ -188,5 +188,5 @@ fi
|
||||
#### [Prev Function Reference](6_reference.md)
|
||||
#### [Next Bashbot Environment](8_custom.md)
|
||||
|
||||
#### $$VERSION$$ v0.80-dev3-5-g83623ec
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
|
||||
|
@ -131,5 +131,5 @@ for every poll until the maximum of BASHBOT_SLEEP ms.
|
||||
|
||||
#### [Prev Notes for Developers](7_develop.md)
|
||||
|
||||
#### $$VERSION$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
|
||||
|
@ -55,6 +55,6 @@ convert existing bots.
|
||||
|
||||
**external-use** will contain some examples on how to send messages from external scripts to Telegram chats or users.
|
||||
|
||||
#### $$VERSION$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
|
||||
|
||||
|
@ -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$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
|
||||
# adjust your language setting here
|
||||
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment
|
||||
|
@ -2,7 +2,7 @@
|
||||
# file: run_filename
|
||||
# background job to display content of all new files in WATCHDIR
|
||||
#
|
||||
#### $$VERSION$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
|
||||
# adjust your language setting here
|
||||
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment
|
||||
|
@ -2,7 +2,7 @@
|
||||
# file: run_filename
|
||||
# background job to display all new files in WATCHDIR
|
||||
#
|
||||
#### $$VERSION$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
|
||||
# adjust your language setting here
|
||||
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment
|
||||
|
@ -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$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
|
||||
# adjust your language setting here
|
||||
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment
|
||||
|
@ -2,7 +2,7 @@
|
||||
# file. multibot.sh
|
||||
# description: run multiple telegram bots from one installation
|
||||
#
|
||||
#### $$VERSION$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
|
||||
if [ "${2}" = "" ] || [ "${2}" = "-h" ]; then
|
||||
echo "Usage: $0 botname command"
|
||||
|
@ -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$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
|
||||
|
||||
SHELL=/bin/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$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
|
||||
# adjust your language setting here
|
||||
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment
|
||||
|
@ -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$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
|
||||
# adjust your language setting here
|
||||
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment
|
||||
|
@ -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$$ v0.80-dev3-2-ga1a823b
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
|
||||
# adjust your language setting here
|
||||
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment
|
||||
|
@ -1,7 +1,7 @@
|
||||
# file: botacl
|
||||
# a user not listed here, will return false from 'user_is_allowed'
|
||||
#
|
||||
#### $$VERSION$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
# Format:
|
||||
# user:ressource:chat
|
||||
|
||||
|
@ -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$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
#
|
||||
# shellcheck disable=SC2154
|
||||
# shellcheck disable=SC2034
|
||||
|
@ -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$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
#
|
||||
# source from commands.sh to use the aliases
|
||||
|
||||
|
@ -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$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
|
||||
# source from commands.sh to use the inline functions
|
||||
|
||||
@ -97,6 +97,6 @@ inline_query_compose(){
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "${JSON}"
|
||||
printf '%s\n' "${JSON}"
|
||||
}
|
||||
|
||||
|
@ -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$$ v0.80-dev3-6-gbeb77a4
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
|
||||
# source from commands.sh if you want ro use interactive or background jobs
|
||||
|
||||
@ -38,7 +38,7 @@ killproc() {
|
||||
# $3 jobname
|
||||
start_back() {
|
||||
local fifo; fifo="${TMPDIR:-.}/$(procname "$1")"
|
||||
echo "$1:$3:$2" >"${fifo}$3-back.cmd"
|
||||
printf '%s\n' "$1:$3:$2" >"${fifo}$3-back.cmd"
|
||||
start_proc "$1" "$2" "back-$3-"
|
||||
}
|
||||
|
||||
@ -95,7 +95,12 @@ kill_proc() {
|
||||
|
||||
# $1 chat
|
||||
# $2 message
|
||||
forward_interactive() {
|
||||
send_interactive() {
|
||||
local fifo; fifo="${TMPDIR:-.}/$(procname "$1")"
|
||||
[ -p "${fifo}" ] && echo "$2" >"${fifo}"
|
||||
[ -p "${fifo}" ] && printf '%s\n' "$2" >"${fifo}" & # not blocking!
|
||||
}
|
||||
|
||||
# old style but may not work because of local checks
|
||||
inproc() {
|
||||
send_interactive "${CHAT[ID]}" "${MESSAGE}"
|
||||
}
|
||||
|
@ -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$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
|
||||
# source from commands.sh to use the member functions
|
||||
|
||||
@ -48,7 +48,7 @@ user_is_botadmin() {
|
||||
local admin; admin="$(head -n 1 "${BOTADMIN}")"
|
||||
[ "${admin}" = "${1}" ] && return 0
|
||||
[[ "${admin}" = "@*" ]] && [[ "${admin}" = "${2}" ]] && return 0
|
||||
if [ "${admin}" = "?" ]; then echo "${1:-?}" >"${BOTADMIN}"; return 0; fi
|
||||
if [ "${admin}" = "?" ]; then printf '%s\n' "${1:-?}" >"${BOTADMIN}"; return 0; fi
|
||||
return 1
|
||||
}
|
||||
|
||||
|
@ -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$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
|
||||
# source from commands.sh to use the sendMessage functions
|
||||
|
||||
@ -48,12 +48,12 @@ send_html_message() {
|
||||
old_send_keyboard() {
|
||||
local text='"text":"'"${2}"'"'
|
||||
shift 2
|
||||
local keyboard=init
|
||||
OLDIFS=$IFS
|
||||
IFS=$(echo -en "\"")
|
||||
local keyboard="init"
|
||||
OLDIFS="$IFS"
|
||||
IFS="\""
|
||||
for f in "$@" ;do [ "$f" != " " ] && keyboard="$keyboard, [\"$f\"]";done
|
||||
IFS=$OLDIFS
|
||||
keyboard=${keyboard/init, /}
|
||||
IFS="$OLDIFS"
|
||||
keyboard="${keyboard/init, /}"
|
||||
sendJson "${1}" "${text}"', "reply_markup": {"keyboard": [ '"${keyboard}"' ],"one_time_keyboard": true}' "$MSG_URL"
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
# files: mycommands.sh.dist
|
||||
# copy to mycommands.sh and add all your commands and functions here ...
|
||||
#
|
||||
#### $$VERSION$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
#
|
||||
|
||||
# uncomment the following lines to overwrite info and help messages
|
||||
|
@ -2,7 +2,7 @@
|
||||
#
|
||||
# ADD a new test skeleton to test dir, but does not activate test
|
||||
#
|
||||
#### $$VERSION$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
|
||||
# magic to ensure that we're always inside the root of our application,
|
||||
# no matter from which directory we'll run script
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#### $$VERSION$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
|
||||
# common variables
|
||||
export TESTME DIRME TESTDIR LOGFILE REFDIR TESTNAME
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#### $$VERSION$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
|
||||
../dev/hooks/pre-commit.sh
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
# file: b-example-test.sh
|
||||
#### $$VERSION$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
|
||||
# include common functions and definitions
|
||||
# shellcheck source=test/ALL-tests.inc.sh
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#### $$VERSION$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
|
||||
# include common functions and definitions
|
||||
# shellcheck source=test/ALL-tests.inc.sh
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#### $$VERSION$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
|
||||
# include common functions and definitions
|
||||
# shellcheck source=test/ALL-tests.inc.sh
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#### $$VERSION$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
|
||||
# include common functions and definitions
|
||||
# shellcheck source=test/ALL-tests.inc.sh
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#### $$VERSION$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
|
||||
# include common functions and definitions
|
||||
# shellcheck source=test/ALL-tests.inc.sh
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#### $$VERSION$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
|
||||
# include common functions and definitions
|
||||
# shellcheck source=test/ALL-tests.inc.sh
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#### $$VERSION$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
|
||||
# include common functions and definitions
|
||||
# shellcheck source=test/ALL-tests.inc.sh
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
#### $$VERSION$$ v0.80-dev3-0-g31a5d00
|
||||
#### $$VERSION$$ v0.80-pre-0-gdd7c66d
|
||||
|
||||
# include common functions and definitions
|
||||
# shellcheck source=test/ALL-tests.inc.sh
|
||||
|
Loading…
Reference in New Issue
Block a user