stormbot/modules/spin/spin.sh

28 lines
553 B
Bash
Raw Normal View History

2020-07-29 20:12:32 -04:00
[ -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
2020-07-29 20:12:32 -04:00
message="${message} $spin $spin $spin "
2020-07-31 12:58:04 -04:00
spinCount=$((RANDOM % 7 + 7))
for i in $(seq $spinCount) ; do
spin+="$spinPlus"
message+="$spin "
2020-07-29 20:12:32 -04:00
done
msg "$chan" "$message"