mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2024-09-28 00:09:02 +00:00
option to ignore commands for other bots if admin
This commit is contained in:
parent
d1f2bc8137
commit
4442382a10
@ -11,7 +11,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$$ v1.2-dev2-15-g3496a21
|
#### $$VERSION$$ v1.2-dev2-20-gd1f2bc8
|
||||||
#
|
#
|
||||||
# Exit Codes:
|
# Exit Codes:
|
||||||
# - 0 success (hopefully)
|
# - 0 success (hopefully)
|
||||||
@ -305,7 +305,7 @@ declare -rx BOTTOKEN URL ME_URL UPD_URL GETFILE_URL
|
|||||||
declare -ax CMD
|
declare -ax CMD
|
||||||
declare -Ax UPD BOTSENT USER MESSAGE URLS CONTACT LOCATION CHAT FORWARD REPLYTO VENUE iQUERY
|
declare -Ax UPD BOTSENT USER MESSAGE URLS CONTACT LOCATION CHAT FORWARD REPLYTO VENUE iQUERY
|
||||||
declare -Ax SERVICE NEWMEMBER LEFTMEMBER PINNED MIGRATE
|
declare -Ax SERVICE NEWMEMBER LEFTMEMBER PINNED MIGRATE
|
||||||
export res CAPTION
|
export res CAPTION ME
|
||||||
|
|
||||||
|
|
||||||
##################
|
##################
|
||||||
|
14
commands.sh
14
commands.sh
@ -15,7 +15,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$$ v1.2-dev2-17-gdfe9c7e
|
#### $$VERSION$$ v1.2-dev2-20-gd1f2bc8
|
||||||
#
|
#
|
||||||
|
|
||||||
# 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.
|
||||||
@ -65,8 +65,9 @@ fi
|
|||||||
#----------------------------
|
#----------------------------
|
||||||
# this file *MUST* not edited!
|
# this file *MUST* not edited!
|
||||||
# copy "mycommands.sh.dist" to "mycommands.sh" and change the values there
|
# copy "mycommands.sh.dist" to "mycommands.sh" and change the values there
|
||||||
# defaults to no inline and nonsense home dir
|
# defaults to no inline, all commands and nonsense home dir
|
||||||
export INLINE="0"
|
export INLINE="0"
|
||||||
|
export MEONLY="0"
|
||||||
export FILE_REGEX="${BASHBOT_ETC}/.*"
|
export FILE_REGEX="${BASHBOT_ETC}/.*"
|
||||||
|
|
||||||
|
|
||||||
@ -86,6 +87,15 @@ if [ -z "${1}" ] || [[ "${1}" == *"debug"* ]];then
|
|||||||
# your commands are in mycommands()
|
# your commands are in mycommands()
|
||||||
else
|
else
|
||||||
|
|
||||||
|
###################
|
||||||
|
# if is bashbot is group admin it get commands sent to other bots
|
||||||
|
# set MEONLY=1 to ignore commands for other bots
|
||||||
|
if [[ "${MEONLY}" != "0" && "${MESSAGE}" == "/"* && "${MESSAGE%% *}" == *"@"* ]]; then
|
||||||
|
# here we have a command with @xyz_bot added, check if it's our bot
|
||||||
|
MYCHECK="${MESSAGE%% *}"
|
||||||
|
[ "${MYCHECK}" != "${MYCHECK%%@${ME}}" ] && return
|
||||||
|
fi
|
||||||
|
|
||||||
###################
|
###################
|
||||||
# user defined commands must placed in mycommands
|
# user defined commands must placed in mycommands
|
||||||
! _is_function mycommands || mycommands
|
! _is_function mycommands || mycommands
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
# #### mycommands.clean
|
# #### mycommands.clean
|
||||||
#
|
#
|
||||||
# shellcheck disable=SC1117
|
# shellcheck disable=SC1117
|
||||||
#### $$VERSION$$ v1.2-dev2-18-g84b893c
|
#### $$VERSION$$ v1.2-dev2-20-gd1f2bc8
|
||||||
#
|
#
|
||||||
|
|
||||||
# uncomment the following lines to overwrite info and help messages
|
# uncomment the following lines to overwrite info and help messages
|
||||||
@ -25,6 +25,11 @@ export res=""
|
|||||||
# 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.
|
||||||
export INLINE="0"
|
export INLINE="0"
|
||||||
|
|
||||||
|
# if your bot is group admin it get commands sent to other bots
|
||||||
|
# Set MEONLY to 1 to ignore commands sent to other bots
|
||||||
|
export MEONLY="0"
|
||||||
|
|
||||||
# Set to .* to allow sending files from all locations
|
# Set to .* to allow sending files from all locations
|
||||||
# NOTE: this is a regex, not shell globbing! you must use a valid egex,
|
# NOTE: this is a regex, not shell globbing! you must use a valid egex,
|
||||||
# '.' matches any character and '.*' matches all remaining charatcers!
|
# '.' matches any character and '.*' matches all remaining charatcers!
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
# files: mycommands.sh.clean
|
# files: mycommands.sh.clean
|
||||||
# copy to mycommands.sh and add all your commands and functions here ...
|
# copy to mycommands.sh and add all your commands and functions here ...
|
||||||
#
|
#
|
||||||
#### $$VERSION$$ v1.2-dev2-18-g84b893c
|
#### $$VERSION$$ v1.2-dev2-20-gd1f2bc8
|
||||||
#
|
#
|
||||||
|
|
||||||
##########
|
##########
|
||||||
@ -21,6 +21,10 @@ export res=""
|
|||||||
# To enable this option in your bot must also send the /setinline command to @BotFather.
|
# To enable this option in your bot must also send the /setinline command to @BotFather.
|
||||||
export INLINE="0"
|
export INLINE="0"
|
||||||
|
|
||||||
|
# if your bot is group admin it get commands sent to other bots
|
||||||
|
# Set MEONLY to 1 to ignore commands sent to other bots
|
||||||
|
export MEONLY="0"
|
||||||
|
|
||||||
# NOTE: this is a regex, not shell globbing! you must use a valid egex,
|
# NOTE: this is a regex, not shell globbing! you must use a valid egex,
|
||||||
# '.' matches any character and '.*' matches all remaining charatcers!
|
# '.' matches any character and '.*' matches all remaining charatcers!
|
||||||
# additionally you must escape special characters with '\', e.g. '\. \? \[ \*" to match them literally
|
# additionally you must escape special characters with '\', e.g. '\. \? \[ \*" to match them literally
|
||||||
|
Loading…
Reference in New Issue
Block a user