Advertisement
Guest User

antiflood.sh

a guest
Aug 19th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.87 KB | None | 0 0
  1. fun_span () {
  2. local USUARIO="$1"
  3. local GRUPO="$2"
  4. local CAMINHO="/etc/ShellBot/Usuarios/$GRUPO/"
  5. unset USRARRAY
  6. declare -A USRARRAY
  7. [[ ! -e $CAMINHO/timearray.sh ]] && touch $CAMINHO/timearray.sh
  8. source $CAMINHO/timearray.sh || rm $CAMINHO/timearray.sh
  9. [[ ${USRARRAY[$USUARIO]} -gt "3" ]] && funcao_span "$USUARIO" "$GRUPO" && return 0 # DEFINE VALOR MAXIMO DE MSG
  10. local VALUE=$(cat $CAMINHO/timearray.sh|grep -v "$USUARIO") && rm $CAMINHO/timearray.sh
  11. while read line; do
  12. echo $line >> $CAMINHO/timearray.sh
  13. done <<< "$VALUE"
  14. let USRARRAY[$USUARIO]++
  15. echo "USRARRAY[$USUARIO]='${USRARRAY[$USUARIO]}'" >> $CAMINHO/timearray.sh
  16. [[ ${USRARRAY[$USUARIO]} -gt "1" ]] && return 0
  17. (
  18. sleep 5s # TEMPO DE SPAN
  19. VALUE=$(cat $CAMINHO/timearray.sh|grep -v "$USUARIO") && rm $CAMINHO/timearray.sh
  20. while read line; do
  21. echo $line >> $CAMINHO/timearray.sh
  22. done <<< "$VALUE"
  23. ) &
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement