2016-09-06 14:25:46 -04:00
[ -f functions.sh ] && source functions.sh
2016-09-06 18:17:34 -04:00
who = " $1 "
shift
2016-09-06 14:25:46 -04:00
chan = " $1 "
shift
# each word is stored in an associative array, with the actions to be taken as the array's contents.
2016-09-06 18:17:34 -04:00
# the variable $chan contains the channel that caused the trigger.
# the variable $who contains the nick that caused the trigger.
2016-09-06 14:25:46 -04:00
declare -A keywords
2016-09-06 18:17:34 -04:00
keywords[ linux] = " msg \" $chan \" \"awesome!\" "
keywords[ chicken] = " msg \" $chan \" \" $who , I'm gonna grab me $( shuf -n1 -e "a case of beer" "a weed eater" "a 5 gallon jug of vaseline" ) and a $( shuf -n1 -e dead frozen live young) chicken, and have fun ALL NIGHT LONG!!!\" "
2016-09-06 14:25:46 -04:00
wordList = " $( echo " $@ " | tr '[:space:]' $'\n' | sort -u) "
for w in ${ wordList //[[ : punct : ]]/ } ; do
if [ [ -n " ${ keywords [ ${ w ,, } ] } " ] ] ; then
eval ${ keywords [ ${ w ,, } ] }
fi
done