mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2024-11-22 15:35:09 +00:00
optimize emtpy sting checks in commands and addons
This commit is contained in:
parent
0e75138548
commit
d28f9752d2
@ -4,7 +4,7 @@
|
|||||||
# this addon counts how many files, e.g. stickers, are sent to
|
# this addon counts how many files, e.g. stickers, are sent to
|
||||||
# a chat and takes actions if threshold is reached
|
# a chat and takes actions if threshold is reached
|
||||||
#
|
#
|
||||||
#### $$VERSION$$ v0.94-dev3-0-geef955a
|
#### $$VERSION$$ v0.94-pre-3-g0e75138
|
||||||
|
|
||||||
# used events:
|
# used events:
|
||||||
#
|
#
|
||||||
@ -99,7 +99,7 @@ if [[ "$1" = "start"* ]]; then
|
|||||||
|
|
||||||
antiFlood_multievent(){
|
antiFlood_multievent(){
|
||||||
# not started
|
# not started
|
||||||
[ "${ANTIFL_CHATS["${CHAT[ID]}","level"]}" = "" ] && return
|
[ -z "${ANTIFL_CHATS["${CHAT[ID]}","level"]}" ] && return
|
||||||
# count user flood text
|
# count user flood text
|
||||||
if [ "$1" = "text" ]; then
|
if [ "$1" = "text" ]; then
|
||||||
if [ "${#MESSAGE[0]}" -gt "${ANTIFL_CHATS["${CHAT[ID]}","level"]}" ]; then
|
if [ "${#MESSAGE[0]}" -gt "${ANTIFL_CHATS["${CHAT[ID]}","level"]}" ]; then
|
||||||
|
@ -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$$ v0.94-pre-2-gc0a633f
|
#### $$VERSION$$ v0.94-pre-3-g0e75138
|
||||||
#
|
#
|
||||||
# Exit Codes:
|
# Exit Codes:
|
||||||
# - 0 sucess (hopefully)
|
# - 0 sucess (hopefully)
|
||||||
|
@ -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$$ v0.94-pre-2-gc0a633f
|
#### $$VERSION$$ v0.94-pre-3-g0e75138
|
||||||
#
|
#
|
||||||
|
|
||||||
# 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.
|
||||||
@ -51,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}" != "" ]; then
|
if [ -n "${1}" ]; then
|
||||||
# load all readable modules
|
# load all readable modules
|
||||||
for modules in "${MODULEDIR:-.}"/*.sh ; do
|
for modules in "${MODULEDIR:-.}"/*.sh ; do
|
||||||
if [[ "${1}" == *"debug"* ]] || ! _is_function "$(basename "${modules}")"; then
|
if [[ "${1}" == *"debug"* ]] || ! _is_function "$(basename "${modules}")"; then
|
||||||
@ -74,10 +74,10 @@ 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}" = "" ] || [[ "${1}" == *"debug"* ]];then
|
if [ -z "${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" ] && [ -n "${iQUERY[ID]}" ]; then
|
||||||
# forward iinline query to optional dispatcher
|
# forward iinline query to optional dispatcher
|
||||||
_exec_if_function myinlines
|
_exec_if_function myinlines
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
# #### if you start to develop your own bot, use the clean version of this file:
|
# #### if you start to develop your own bot, use the clean version of this file:
|
||||||
# #### mycommands.clean
|
# #### mycommands.clean
|
||||||
#
|
#
|
||||||
#### $$VERSION$$ v0.94-pre-0-gac2ec02
|
#### $$VERSION$$ v0.94-pre-3-g0e75138
|
||||||
#
|
#
|
||||||
|
|
||||||
# uncomment the following lines to overwrite info and help messages
|
# uncomment the following lines to overwrite info and help messages
|
||||||
@ -55,7 +55,7 @@ else
|
|||||||
##############
|
##############
|
||||||
# a service Message was recieved
|
# a service Message was recieved
|
||||||
# add your own stuff here
|
# add your own stuff here
|
||||||
if [[ "${SERVICE}" != "" ]]; then
|
if [ -n "${SERVICE}" ]; then
|
||||||
|
|
||||||
# example: delete every service message
|
# example: delete every service message
|
||||||
if [ "${SILENCER}" = "yes" ]; then
|
if [ "${SILENCER}" = "yes" ]; then
|
||||||
|
@ -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$$ v0.94-pre-0-gac2ec02
|
#### $$VERSION$$ v0.94-pre-3-g0e75138
|
||||||
#
|
#
|
||||||
|
|
||||||
##########
|
##########
|
||||||
@ -56,7 +56,7 @@ else
|
|||||||
##############
|
##############
|
||||||
# a service Message was recieved
|
# a service Message was recieved
|
||||||
# add your own stuff here
|
# add your own stuff here
|
||||||
if [[ "${SERVICE}" != "" ]]; then
|
if [ -n "${SERVICE}" ]; then
|
||||||
|
|
||||||
# example: delete every service message
|
# example: delete every service message
|
||||||
if [ "${SILENCER}" = "yes" ]; then
|
if [ "${SILENCER}" = "yes" ]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user