Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fun_span () {
- local USUARIO="$1"
- local GRUPO="$2"
- local CAMINHO="/etc/ShellBot/Usuarios/$GRUPO/"
- unset USRARRAY
- declare -A USRARRAY
- [[ ! -e $CAMINHO/timearray.sh ]] && touch $CAMINHO/timearray.sh
- source $CAMINHO/timearray.sh || rm $CAMINHO/timearray.sh
- [[ ${USRARRAY[$USUARIO]} -gt "3" ]] && funcao_span "$USUARIO" "$GRUPO" && return 0 # DEFINE VALOR MAXIMO DE MSG
- local VALUE=$(cat $CAMINHO/timearray.sh|grep -v "$USUARIO") && rm $CAMINHO/timearray.sh
- while read line; do
- echo $line >> $CAMINHO/timearray.sh
- done <<< "$VALUE"
- let USRARRAY[$USUARIO]++
- echo "USRARRAY[$USUARIO]='${USRARRAY[$USUARIO]}'" >> $CAMINHO/timearray.sh
- [[ ${USRARRAY[$USUARIO]} -gt "1" ]] && return 0
- (
- sleep 5s # TEMPO DE SPAN
- VALUE=$(cat $CAMINHO/timearray.sh|grep -v "$USUARIO") && rm $CAMINHO/timearray.sh
- while read line; do
- echo $line >> $CAMINHO/timearray.sh
- done <<< "$VALUE"
- ) &
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement