mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2025-01-01 06:11:46 +00:00
make it clear to NOT edit commands.sh whenever possible
This commit is contained in:
parent
8a119f8806
commit
bf8a9117aa
32
commands.sh
32
commands.sh
@ -1,11 +1,21 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# file: commands.sh
|
# 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.
|
# 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$$ 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.
|
# 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
|
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
|
||||||
|
|
||||||
# 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.
|
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 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.
|
||||||
'
|
'
|
||||||
|
|
||||||
# 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*:
|
bashbot_help='*Available commands*:
|
||||||
*• /start*: _Start bot and get this message_.
|
*• /start*: _Start bot and get this message_.
|
||||||
*• /help*: _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
|
# 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
|
# load all readable modules
|
||||||
for modules in "${MODULEDIR:-.}"/*.sh ; do
|
for modules in "${MODULEDIR:-.}"/*.sh ; do
|
||||||
# shellcheck source=./modules/aliases.sh
|
# shellcheck source=./modules/aliases.sh
|
||||||
@ -45,6 +59,9 @@ if [ "${1}" = "source" ] || [[ "${1}" = *"debug"* ]] ; then
|
|||||||
done
|
done
|
||||||
fi
|
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
|
# defaults to no inline and nonsense home dir
|
||||||
export INLINE="0"
|
export INLINE="0"
|
||||||
export FILE_REGEX='/home/user/allowed/.*'
|
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}"
|
[ -r "${BASHBOT_ETC:-.}/mycommands.sh" ] && source "${BASHBOT_ETC:-.}/mycommands.sh" "${1}"
|
||||||
|
|
||||||
|
|
||||||
if [ "${1}" != "source" ];then
|
if [ "${1}" = "" ] || [[ "${1}" == *"debug"* ]];then
|
||||||
# detect inline commands....
|
# detect inline commands....
|
||||||
# no default commands, all processing is done in myinlines()
|
# no default commands, all processing is done in myinlines()
|
||||||
if [ "$INLINE" != "0" ] && [ "${iQUERY[ID]}" != "" ]; then
|
if [ "$INLINE" != "0" ] && [ "${iQUERY[ID]}" != "" ]; then
|
||||||
@ -75,6 +92,9 @@ if [ "${1}" != "source" ];then
|
|||||||
if [ "$?" = "0" ]; then
|
if [ "$?" = "0" ]; then
|
||||||
case "${MESSAGE}" in
|
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
|
# GLOBAL commands start here, edit messages only
|
||||||
'/info'*)
|
'/info'*)
|
||||||
send_markdown_message "${CHAT[ID]}" "${bashbot_info}"
|
send_markdown_message "${CHAT[ID]}" "${bashbot_info}"
|
||||||
|
Loading…
Reference in New Issue
Block a user