mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2024-06-03 19:00:50 +00:00
better handling of sourcing files
This commit is contained in:
parent
2eac362dc7
commit
b1aef7d6f9
|
@ -102,4 +102,4 @@ Bashbot is not more (in)secure as any other Bot written in any other language, w
|
||||||
|
|
||||||
If you feel that there's something missing or if you found a bug, feel free to submit a pull request!
|
If you feel that there's something missing or if you found a bug, feel free to submit a pull request!
|
||||||
|
|
||||||
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
#### $$VERSION$$ 0.70-dev-16-g2eac362
|
||||||
|
|
|
@ -166,5 +166,5 @@ That's it!
|
||||||
If you feel that there's something missing or if you found a bug, feel
|
If you feel that there's something missing or if you found a bug, feel
|
||||||
free to submit a pull request!
|
free to submit a pull request!
|
||||||
|
|
||||||
latexmath:[\[VERSION\]] 0.70-dev-11-g41b8e69
|
latexmath:[\[VERSION\]] 0.70-dev-16-g2eac362
|
||||||
++++++++++++++++++++++++++++++++++++++++++++
|
++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# description: Start or stop telegram-bash-bot
|
# description: Start or stop telegram-bash-bot
|
||||||
#
|
#
|
||||||
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
#### $$VERSION$$ 0.70-dev-16-g2eac362
|
||||||
# shellcheck disable=SC2009
|
# shellcheck disable=SC2009
|
||||||
# shellcheck disable=SC2181
|
# shellcheck disable=SC2181
|
||||||
|
|
||||||
|
|
64
bashbot.sh
64
bashbot.sh
|
@ -10,7 +10,7 @@
|
||||||
# This file is public domain in the USA and all free countries.
|
# This file is public domain in the USA and all free countries.
|
||||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||||
#
|
#
|
||||||
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
#### $$VERSION$$ 0.70-dev-16-g2eac362
|
||||||
#
|
#
|
||||||
# Exit Codes:
|
# Exit Codes:
|
||||||
# - 0 sucess (hopefully)
|
# - 0 sucess (hopefully)
|
||||||
|
@ -34,7 +34,7 @@ SCRIPT="./$(basename "$0")"
|
||||||
SCRIPTDIR="$(dirname "$0")"
|
SCRIPTDIR="$(dirname "$0")"
|
||||||
RUNUSER="${USER}" # USER is overwritten by bashbot array, $USER may not work later on...
|
RUNUSER="${USER}" # USER is overwritten by bashbot array, $USER may not work later on...
|
||||||
|
|
||||||
if ! cd "${SCRIPTDIR}" ; then
|
if [ "$1" != "source" ] && ! cd "${SCRIPTDIR}" ; then
|
||||||
echo -e "${RED}ERROR: Can't change to ${SCRIPTDIR} ...${NC}"
|
echo -e "${RED}ERROR: Can't change to ${SCRIPTDIR} ...${NC}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -95,28 +95,31 @@ elif [ ! -w "${TMPDIR}" ]; then
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
COUNT="./count"
|
COUNTFILE="./count"
|
||||||
if [ ! -f "${COUNT}" ]; then
|
if [ ! -f "${COUNTFILE}" ]; then
|
||||||
touch "${COUNT}"
|
touch "${COUNTFILE}"
|
||||||
elif [ ! -w "${COUNT}" ]; then
|
elif [ ! -w "${COUNTFILE}" ]; then
|
||||||
${CLEAR}
|
${CLEAR}
|
||||||
echo -e "${RED}ERROR: Can't write to ${COUNT}!.${NC}"
|
echo -e "${RED}ERROR: Can't write to ${COUNTFILE}!.${NC}"
|
||||||
ls -l "${COUNT}"
|
ls -l "${COUNTFILE}"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
COMMANDS="./commands.sh"
|
COMMANDS="./commands.sh"
|
||||||
if [ ! -f "${COMMANDS}" ] || [ ! -r "${COMMANDS}" ]; then
|
if [ "$1" != "source" ]; then
|
||||||
|
if [ ! -f "${COMMANDS}" ] || [ ! -r "${COMMANDS}" ]; then
|
||||||
${CLEAR}
|
${CLEAR}
|
||||||
echo -e "${RED}ERROR: ${COMMANDS} does not exist or is not readable!.${NC}"
|
echo -e "${RED}ERROR: ${COMMANDS} does not exist or is not readable!.${NC}"
|
||||||
exit 3
|
|
||||||
ls -l "${COMMANDS}"
|
ls -l "${COMMANDS}"
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
# shellcheck source=./commands.sh
|
||||||
|
source "${COMMANDS}" "source"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# shellcheck source=./commands.sh
|
|
||||||
source "${COMMANDS}" "source"
|
|
||||||
|
|
||||||
URL='https://api.telegram.org/bot'$TOKEN
|
BOTTOKEN="$(cat "${TOKENFILE}")"
|
||||||
|
URL='https://api.telegram.org/bot'$BOTTOKEN
|
||||||
|
|
||||||
|
|
||||||
MSG_URL=$URL'/sendMessage'
|
MSG_URL=$URL'/sendMessage'
|
||||||
|
@ -139,7 +142,7 @@ DELETE_URL=$URL'/deleteMessage'
|
||||||
GETMEMBER_URL=$URL'/getChatMember'
|
GETMEMBER_URL=$URL'/getChatMember'
|
||||||
|
|
||||||
|
|
||||||
FILE_URL='https://api.telegram.org/file/bot'$TOKEN'/'
|
FILE_URL='https://api.telegram.org/file/bot'$BOTTOKEN'/'
|
||||||
UPD_URL=$URL'/getUpdates?offset='
|
UPD_URL=$URL'/getUpdates?offset='
|
||||||
GET_URL=$URL'/getFile'
|
GET_URL=$URL'/getFile'
|
||||||
OFFSET=0
|
OFFSET=0
|
||||||
|
@ -592,7 +595,7 @@ process_client() {
|
||||||
source commands.sh
|
source commands.sh
|
||||||
|
|
||||||
tmpcount="COUNT${CHAT[ID]}"
|
tmpcount="COUNT${CHAT[ID]}"
|
||||||
grep -q "$tmpcount" <"${COUNT}" >/dev/null 2>&1 || echo "$tmpcount">>${COUNT}
|
grep -q "$tmpcount" <"${COUNTFILE}" >/dev/null 2>&1 || echo "$tmpcount">>${COUNTFILE}
|
||||||
# To get user count execute bash bashbot.sh count
|
# To get user count execute bash bashbot.sh count
|
||||||
}
|
}
|
||||||
# get bot name
|
# get bot name
|
||||||
|
@ -636,7 +639,10 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# source the script with source as param to use functions in other scripts
|
# source the script with source as param to use functions in other scripts
|
||||||
while [ "$1" = "startbot" ]; do {
|
# do not execute if read from other scripts
|
||||||
|
|
||||||
|
if [ "$1" != "source" ]; then
|
||||||
|
while [ "$1" = "startbot" ]; do {
|
||||||
|
|
||||||
UPDATE="$(curl -s "$UPD_URL$OFFSET" | ./JSON.sh/JSON.sh)"
|
UPDATE="$(curl -s "$UPD_URL$OFFSET" | ./JSON.sh/JSON.sh)"
|
||||||
|
|
||||||
|
@ -652,10 +658,10 @@ while [ "$1" = "startbot" ]; do {
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}; done
|
}; done
|
||||||
|
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
"outproc")
|
"outproc")
|
||||||
until [ "$line" = "imprettydarnsuredatdisisdaendofdacmd" ];do
|
until [ "$line" = "imprettydarnsuredatdisisdaendofdacmd" ];do
|
||||||
line=""
|
line=""
|
||||||
|
@ -665,15 +671,15 @@ case "$1" in
|
||||||
rm -f -r "${TMPDIR:-.}/$3"
|
rm -f -r "${TMPDIR:-.}/$3"
|
||||||
;;
|
;;
|
||||||
"count")
|
"count")
|
||||||
echo "A total of $(wc -l <"${COUNT}") users used me."
|
echo "A total of $(wc -l <"${COUNTFILE}") users used me."
|
||||||
exit
|
exit
|
||||||
;;
|
;;
|
||||||
"broadcast")
|
"broadcast")
|
||||||
NUMCOUNT="$(wc -l <"${COUNT}")"
|
NUMCOUNT="$(wc -l <"${COUNTFILE}")"
|
||||||
echo "Sending the broadcast $* to $NUMCOUNT users."
|
echo "Sending the broadcast $* to $NUMCOUNT users."
|
||||||
[ "$NUMCOUNT" -gt "300" ] && sleep="sleep 0.5"
|
[ "$NUMCOUNT" -gt "300" ] && sleep="sleep 0.5"
|
||||||
shift
|
shift
|
||||||
while read -r f; do send_message "${f//COUNT}" "$*"; $sleep; done <"${COUNT}"
|
while read -r f; do send_message "${f//COUNT}" "$*"; $sleep; done <"${COUNTFILE}"
|
||||||
;;
|
;;
|
||||||
"start")
|
"start")
|
||||||
${CLEAR}
|
${CLEAR}
|
||||||
|
@ -696,8 +702,8 @@ case "$1" in
|
||||||
chown -R "$TOUSER" . ./*
|
chown -R "$TOUSER" . ./*
|
||||||
chmod 711 .
|
chmod 711 .
|
||||||
chmod -R a-w ./*
|
chmod -R a-w ./*
|
||||||
chmod -R u+w "${COUNT}" "${TMPDIR}" "${BOTADMIN}" ./*.log 2>/dev/null
|
chmod -R u+w "${COUNTFILE}" "${TMPDIR}" "${BOTADMIN}" ./*.log 2>/dev/null
|
||||||
chmod -R o-r,o-w "${COUNT}" "${TMPDIR}" "${TOKENFILE}" "${BOTADMIN}" "${BOTACL}" 2>/dev/null
|
chmod -R o-r,o-w "${COUNTFILE}" "${TMPDIR}" "${TOKENFILE}" "${BOTADMIN}" "${BOTACL}" 2>/dev/null
|
||||||
ls -la
|
ls -la
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
@ -754,19 +760,19 @@ case "$1" in
|
||||||
tmux attach -t "$ME"
|
tmux attach -t "$ME"
|
||||||
;;
|
;;
|
||||||
"source")
|
"source")
|
||||||
|
# this should never happen
|
||||||
echo "OK"
|
echo "OK"
|
||||||
exit
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo -e "${RED}${ME}: BAD REQUEST${NC}"
|
echo -e "${RED}${ME}: BAD REQUEST${NC}"
|
||||||
echo -e "${RED}Available arguments: outproc, count, broadcast, start, suspendback, resumeback, kill, killback, help, attach${NC}"
|
echo -e "${RED}Available arguments: outproc, count, broadcast, start, suspendback, resumeback, kill, killback, help, attach${NC}"
|
||||||
exit 4
|
exit 4
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# warn if root
|
# warn if root
|
||||||
if [[ "$(id -u)" -eq "0" ]] ; then
|
if [[ "$(id -u)" -eq "0" ]] ; then
|
||||||
echo -e "\\n${ORANGE}WARNING: ${SCRIPT} was started as ROOT (UID 0)!${NC}"
|
echo -e "\\n${ORANGE}WARNING: ${SCRIPT} was started as ROOT (UID 0)!${NC}"
|
||||||
echo -e "${ORANGE}You are at HIGH RISK when processing user input with root privilegs!${NC}"
|
echo -e "${ORANGE}You are at HIGH RISK when processing user input with root privilegs!${NC}"
|
||||||
fi
|
fi
|
||||||
|
fi # end source
|
||||||
|
|
29
commands.sh
29
commands.sh
|
@ -4,7 +4,7 @@
|
||||||
# This file is public domain in the USA and all free countries.
|
# This file is public domain in the USA and all free countries.
|
||||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||||
#
|
#
|
||||||
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
#### $$VERSION$$ 0.70-dev-16-g2eac362
|
||||||
#
|
#
|
||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
|
@ -20,15 +20,16 @@ unset IFS
|
||||||
# set -f # if you are paranoid use set -f to disable globbing
|
# set -f # if you are paranoid use set -f to disable globbing
|
||||||
|
|
||||||
|
|
||||||
# change Info anf Help to fit your needs
|
if [ "$1" != "source" ]; then
|
||||||
bashbot_info() {
|
# change Info anf Help to fit your needs
|
||||||
|
bashbot_info() {
|
||||||
send_markdown_message "${1}" 'This is bashbot, the Telegram bot written entirely in bash.
|
send_markdown_message "${1}" 'This is bashbot, the Telegram bot written entirely in bash.
|
||||||
It features background tasks and interactive chats, and can serve as an interface for CLI programs.
|
It features background tasks and interactive chats, and can serve as an interface for CLI programs.
|
||||||
It currently can send, recieve and forward messages, custom keyboards, photos, audio, voice, documents, locations and video files.
|
It currently can send, recieve and forward messages, custom keyboards, photos, audio, voice, documents, locations and video files.
|
||||||
'
|
'
|
||||||
}
|
}
|
||||||
|
|
||||||
bashbot_help() {
|
bashbot_help() {
|
||||||
send_markdown_message "${1}" '*Available commands*:
|
send_markdown_message "${1}" '*Available commands*:
|
||||||
*• /start*: _Start bot and get this message_.
|
*• /start*: _Start bot and get this message_.
|
||||||
*• /info*: _Get shorter info message about this bot_.
|
*• /info*: _Get shorter info message about this bot_.
|
||||||
|
@ -39,23 +40,21 @@ bashbot_help() {
|
||||||
Written by Drew (@topkecleon), Daniil Gentili (@danogentili) and KayM(@gnadelwartz).
|
Written by Drew (@topkecleon), Daniil Gentili (@danogentili) and KayM(@gnadelwartz).
|
||||||
Get the code in my [GitHub](http://github.com/topkecleon/telegram-bot-bash)
|
Get the code in my [GitHub](http://github.com/topkecleon/telegram-bot-bash)
|
||||||
'
|
'
|
||||||
}
|
}
|
||||||
|
|
||||||
# some handy shortcuts, e.g.:
|
# some handy shortcuts, e.g.:
|
||||||
_is_botadmin() {
|
_is_botadmin() {
|
||||||
user_is_botadmin "${USER[ID]}"
|
user_is_botadmin "${USER[ID]}"
|
||||||
}
|
}
|
||||||
_is_admin() {
|
_is_admin() {
|
||||||
user_is_admin "${CHAT[ID]}" "${USER[ID]}"
|
user_is_admin "${CHAT[ID]}" "${USER[ID]}"
|
||||||
}
|
}
|
||||||
_is_allowed() { # $1 = resource
|
_is_allowed() { # $1 = resource
|
||||||
user_is_allowed "${USER[ID]}" "$1" "${CHAT[ID]}"
|
user_is_allowed "${USER[ID]}" "$1" "${CHAT[ID]}"
|
||||||
}
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$1" = "source" ];then
|
if [ "$1" = "source" ];then
|
||||||
# Place the token in the token file
|
|
||||||
TOKEN="$(cat token)"
|
|
||||||
# Set INLINE to 1 in order to receive inline queries.
|
# Set INLINE to 1 in order to receive inline queries.
|
||||||
# To enable this option in your bot, send the /setinline command to @BotFather.
|
# To enable this option in your bot, send the /setinline command to @BotFather.
|
||||||
INLINE="0"
|
INLINE="0"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
#### $$VERSION$$ 0.70-dev-16-g2eac362
|
||||||
|
|
||||||
# magic to ensure that we're always inside the root of our application,
|
# magic to ensure that we're always inside the root of our application,
|
||||||
# no matter from which directory we'll run script
|
# no matter from which directory we'll run script
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
#### $$VERSION$$ 0.70-dev-16-g2eac362
|
||||||
|
|
||||||
# magic to ensure that we're always inside the root of our application,
|
# magic to ensure that we're always inside the root of our application,
|
||||||
# no matter from which directory we'll run script
|
# no matter from which directory we'll run script
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# this has to run once atfer git clone
|
# this has to run once atfer git clone
|
||||||
# and every time we create new hooks
|
# and every time we create new hooks
|
||||||
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
#### $$VERSION$$ 0.70-dev-16-g2eac362
|
||||||
|
|
||||||
# magic to ensure that we're always inside the root of our application,
|
# magic to ensure that we're always inside the root of our application,
|
||||||
# no matter from which directory we'll run script
|
# no matter from which directory we'll run script
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
# list of additional files to check from shellcheck
|
# list of additional files to check from shellcheck
|
||||||
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
#### $$VERSION$$ 0.70-dev-16-g2eac362
|
||||||
bashbot.rc
|
bashbot.rc
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
#### $$VERSION$$ 0.70-dev-16-g2eac362
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
#
|
#
|
||||||
# Easy Versioning in git:
|
# Easy Versioning in git:
|
||||||
|
|
|
@ -61,5 +61,5 @@ group. This step is up to you actually.
|
||||||
|
|
||||||
#### [Next Getting started](2_usage.md)
|
#### [Next Getting started](2_usage.md)
|
||||||
|
|
||||||
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
#### $$VERSION$$ 0.70-dev-16-g2eac362
|
||||||
|
|
||||||
|
|
|
@ -159,5 +159,5 @@ send_action "${CHAT[ID]}" "action"
|
||||||
#### [Prev Create Bot](1_firstbot.md)
|
#### [Prev Create Bot](1_firstbot.md)
|
||||||
#### [Next Advanced Usage](3_advanced.md)
|
#### [Next Advanced Usage](3_advanced.md)
|
||||||
|
|
||||||
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
#### $$VERSION$$ 0.70-dev-16-g2eac362
|
||||||
|
|
||||||
|
|
|
@ -156,5 +156,5 @@ answer_inline_query "$iQUERY_ID" "cached_sticker" "identifier for the sticker"
|
||||||
#### [Prev Advanced Usage](3_advanced.md)
|
#### [Prev Advanced Usage](3_advanced.md)
|
||||||
#### [Next Expert Use](4_expert.md)
|
#### [Next Expert Use](4_expert.md)
|
||||||
|
|
||||||
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
#### $$VERSION$$ 0.70-dev-16-g2eac362
|
||||||
|
|
||||||
|
|
|
@ -104,5 +104,5 @@ An example crontab is provided in ```examples/bashbot.cron```.
|
||||||
#### [Prev Expert Use](4_expert.md)
|
#### [Prev Expert Use](4_expert.md)
|
||||||
#### [Next Best Practice](5_practice.md)
|
#### [Next Best Practice](5_practice.md)
|
||||||
|
|
||||||
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
#### $$VERSION$$ 0.70-dev-16-g2eac362
|
||||||
|
|
||||||
|
|
|
@ -112,5 +112,5 @@ The second warning is about an unused variable, this is true because in our exam
|
||||||
#### [Prev Best Practice](5_practice.md)
|
#### [Prev Best Practice](5_practice.md)
|
||||||
#### [Next Functions Reference](6_reference.md)
|
#### [Next Functions Reference](6_reference.md)
|
||||||
|
|
||||||
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
#### $$VERSION$$ 0.70-dev-16-g2eac362
|
||||||
|
|
||||||
|
|
|
@ -348,5 +348,5 @@ Send Input from Telegram to waiting Interactive Chat.
|
||||||
#### [Prev Best Practice](5_practice.md)
|
#### [Prev Best Practice](5_practice.md)
|
||||||
#### [Next Developer Rules](7_develop.md)
|
#### [Next Developer Rules](7_develop.md)
|
||||||
|
|
||||||
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
#### $$VERSION$$ 0.70-dev-16-g2eac362
|
||||||
|
|
||||||
|
|
|
@ -63,5 +63,5 @@ fi
|
||||||
|
|
||||||
#### [Prev Function Reference](6_function.md)
|
#### [Prev Function Reference](6_function.md)
|
||||||
|
|
||||||
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
#### $$VERSION$$ 0.70-dev-16-g2eac362
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
# This file is public domain in the USA and all free countries.
|
# This file is public domain in the USA and all free countries.
|
||||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||||
#
|
#
|
||||||
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
#### $$VERSION$$ 0.70-dev-16-g2eac362
|
||||||
|
|
||||||
|
|
||||||
SHELL=/bin/sh
|
SHELL=/bin/sh
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# This file is public domain in the USA and all free countries.
|
# This file is public domain in the USA and all free countries.
|
||||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||||
|
|
||||||
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
#### $$VERSION$$ 0.70-dev-16-g2eac362
|
||||||
|
|
||||||
# adjust your language setting here
|
# adjust your language setting here
|
||||||
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment
|
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
# This file is public domain in the USA and all free countries.
|
# This file is public domain in the USA and all free countries.
|
||||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||||
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
#### $$VERSION$$ 0.70-dev-16-g2eac362
|
||||||
|
|
||||||
# adjust your language setting here
|
# adjust your language setting here
|
||||||
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment
|
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# This file is public domain in the USA and all free countries.
|
# This file is public domain in the USA and all free countries.
|
||||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||||
|
|
||||||
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
#### $$VERSION$$ 0.70-dev-16-g2eac362
|
||||||
|
|
||||||
# adjust your language setting here
|
# adjust your language setting here
|
||||||
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment
|
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# This file is public domain in the USA and all free countries.
|
# This file is public domain in the USA and all free countries.
|
||||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||||
|
|
||||||
#### $$VERSION$$ 0.70-dev-11-g41b8e69
|
#### $$VERSION$$ 0.70-dev-16-g2eac362
|
||||||
|
|
||||||
# adjust your language setting here
|
# adjust your language setting here
|
||||||
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment
|
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# this has to run once atfer git clone
|
# this has to run once atfer git clone
|
||||||
# and every time we create new hooks
|
# and every time we create new hooks
|
||||||
#### $$VERSION$$ 0.70-dev-15-g074a103
|
#### $$VERSION$$ 0.70-dev-16-g2eac362
|
||||||
|
|
||||||
# magic to ensure that we're always inside the root of our application,
|
# magic to ensure that we're always inside the root of our application,
|
||||||
# no matter from which directory we'll run script
|
# no matter from which directory we'll run script
|
||||||
|
@ -12,6 +12,8 @@ cd "${GIT_DIR}/.." || exit 1
|
||||||
TESTENV="/tmp/bashbot.test$$"
|
TESTENV="/tmp/bashbot.test$$"
|
||||||
cp -r . "${TESTENV}"
|
cp -r . "${TESTENV}"
|
||||||
|
|
||||||
|
cd "${TESTENV}" || exit 1
|
||||||
|
|
||||||
#set -e
|
#set -e
|
||||||
fail=0
|
fail=0
|
||||||
tests=0
|
tests=0
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
#### $$VERSION$$ 0.70-dev-15-g074a103
|
#### $$VERSION$$ 0.70-dev-16-g2eac362
|
||||||
|
|
||||||
# magic to ensure that we're always inside the root of our application,
|
|
||||||
# no matter from which directory we'll run script
|
|
||||||
GIT_DIR=$(git rev-parse --git-dir)
|
|
||||||
cd "$GIT_DIR/.." || exit 1
|
|
||||||
|
|
||||||
dev/hooks/pre-commit.sh
|
dev/hooks/pre-commit.sh
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,4 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
#### $$VERSION$$ 0.70-dev-15-g074a103
|
#### $$VERSION$$ 0.70-dev-16-g2eac362
|
||||||
|
|
||||||
# magic to ensure that we're always inside the root of our application,
|
|
||||||
# no matter from which directory we'll run script
|
|
||||||
GIT_DIR=$(git rev-parse --git-dir)
|
|
||||||
cd "$GIT_DIR/.." || exit 1
|
|
||||||
|
|
||||||
dev/hooks/pre-push.sh
|
dev/hooks/pre-push.sh
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
#### $$VERSION$$ 0.70-dev-15-g074a103
|
#### $$VERSION$$ 0.70-dev-16-g2eac362
|
||||||
|
|
||||||
# magic to ensure that we're always inside the root of our application,
|
|
||||||
# no matter from which directory we'll run script
|
|
||||||
GIT_DIR=$(git rev-parse --git-dir)
|
|
||||||
cd "$GIT_DIR/.." || exit 1
|
|
||||||
|
|
||||||
TOKENFILE="./token"
|
TOKENFILE="./token"
|
||||||
TESTTOKEN="bashbottestscript"
|
TESTTOKEN="bashbottestscript"
|
||||||
|
@ -47,3 +42,10 @@ else
|
||||||
echo "Token not correct or not written!"
|
echo "Token not correct or not written!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "Test Sourcing of bashbot.sh ..."
|
||||||
|
trap exit 1 EXIT
|
||||||
|
|
||||||
|
# shellcheck source=./bashbot.sh
|
||||||
|
source "$1/bashbot.sh" source
|
||||||
|
trap '' EXIT
|
Loading…
Reference in New Issue
Block a user