make it clear to NOT edit commands.sh whenever possible

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2020-05-14 13:27:53 +02:00
parent 8a119f8806
commit bf8a9117aa

View File

@ -1,11 +1,21 @@
#!/bin/bash
# file: commands.sh
# do not edit this file, instead place all your commands in mycommands.sh
# _____ _______ _ _ _
# (____ \ _ (_______) | (_)_ | |
# _ \ \ ___ ____ ___ | |_ _____ _ | |_| |_ | |
# | | | / _ \ | _ \ / _ \| _) | ___) / || | | _)|_|
# | |__/ / |_| | | | | | |_| | |__ | |____( (_| | | |__ _
# |_____/ \___/ |_| |_|\___/ \___) |_______)____|_|\___)_|
#
# this file *MUST* not edited! palce your config and commands in
# the provided mycommnds.sh. a clean version is avalible as mycommands.clean
#
# This file is public domain in the USA and all free countries.
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
#
#### $$VERSION$$ v0.94-dev3-0-geef955a
#### $$VERSION$$ v0.94-dev3-1-g8a119f8
#
# adjust your language setting here, e.g.when run from other user or cron.
@ -17,13 +27,17 @@ export 'LANGUAGE=C.UTF-8'
unset IFS
# set -f # if you are paranoid use set -f to disable globbing
# to change the default info message overwrite bashbot_info in mycommands.sh
#
# this file *MUST* not edited!
# copy "mycommands,sh,dist" to "mycommnds,sh" and change the strings there
bashbot_info='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 currently can send, recieve and forward messages, custom keyboards, photos, audio, voice, documents, locations and video files.
'
# to change the default help messages overwrite in mycommands.sh
#
# this file *MUST* not edited!
# copy "mycommands,sh,dist" to "mycommnds,sh" and change the strings there
bashbot_help='*Available commands*:
*• /start*: _Start bot and get this message_.
*• /help*: _Get this message_.
@ -37,7 +51,7 @@ Get the code in my [GitHub](http://github.com/topkecleon/telegram-bot-bash)
'
# load modues on startup and always on on debug
if [ "${1}" = "source" ] || [[ "${1}" = *"debug"* ]] ; then
if [ "${1}" = "startbot" ] || [[ "${1}" = *"debug"* ]] ; then
# load all readable modules
for modules in "${MODULEDIR:-.}"/*.sh ; do
# shellcheck source=./modules/aliases.sh
@ -45,6 +59,9 @@ if [ "${1}" = "source" ] || [[ "${1}" = *"debug"* ]] ; then
done
fi
#
# this file *MUST* not edited!
# copy "mycommands,sh,dist" to "mycommnds,sh" and change the values there
# defaults to no inline and nonsense home dir
export INLINE="0"
export FILE_REGEX='/home/user/allowed/.*'
@ -55,7 +72,7 @@ export FILE_REGEX='/home/user/allowed/.*'
[ -r "${BASHBOT_ETC:-.}/mycommands.sh" ] && source "${BASHBOT_ETC:-.}/mycommands.sh" "${1}"
if [ "${1}" != "source" ];then
if [ "${1}" = "" ] || [[ "${1}" == *"debug"* ]];then
# detect inline commands....
# no default commands, all processing is done in myinlines()
if [ "$INLINE" != "0" ] && [ "${iQUERY[ID]}" != "" ]; then
@ -75,6 +92,9 @@ if [ "${1}" != "source" ];then
if [ "$?" = "0" ]; then
case "${MESSAGE}" in
################################################
# this file *MUST* not edited!
# copy "mycommands,sh,dist" to "mycommnds,sh" and change the values and add your commands there
#
# GLOBAL commands start here, edit messages only
'/info'*)
send_markdown_message "${CHAT[ID]}" "${bashbot_info}"