stormbot/modules/spin/spin.sh

28 lines
553 B
Bash
Executable File

[ -f functions.sh ] && source functions.sh
userNick="$1"
shift
chan="$1"
shift
message="${*}"
spinPlus="${message##*(}"
spinPlus="${spinPlus%)}"
message="${message% (*)}"
spin="${message##*[[:space:]]}"
if [[ "$spinPlus" == "$message" ]]; then
if [[ "$spin" =~ [aeiou].$ ]]; then
spinPlus="${spin: -1}${spin: -1}"
else
spinPlus="${spin: -2}"
fi
fi
message="${message} $spin $spin $spin "
spinCount=$((RANDOM % 7 + 7))
for i in $(seq $spinCount) ; do
spin+="$spinPlus"
message+="$spin "
done
msg "$chan" "$message"