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
2017-04-08 00:33:42 -04:00
keywords[ linux] = " msg \" $chan \" \"Linux is $( shuf -n1 -e awesome God great lovely fantastic amazing wonderful) !\" "
2017-05-07 15:24:00 -04:00
keywords[ windows] = " msg \" $chan \" \" $( shuf -n1 -e\
"Failure is not an option, it comes bundled with Windows!" \
"Apple got all pissed off because I farted in their store. It's not my falt they don't have Windows..." \
"Windows is dumb!" \
"Did you know that Micro Soft is Linda's pet name for Bill Gates?" \
"A computer without Windows is like a chocolate cake without the mustard." \
"Windows is stupid" \
"In a world without walls and fences - who needs windows and gates?" \
"Windows, plug and pray." \
"Windows - Just another pain in the glass." \
"Windows, it's not pretty, it's not ugly, but it's pretty ugly." ) !\" "
2017-05-06 13:06:30 -04:00
keywords[ emacs] = " msg \" $chan \" \" $who , Real men use vim!\" "
keywords[ emacspeak] = " msg \" $chan \" \" $who , Real men use vim!\" "
keywords[ nano] = " msg \" $chan \" \" $who , Real men use vim!\" "
keywords[ gedit] = " msg \" $chan \" \" $who , Real men use vim!\" "
keywords[ pluma] = " msg \" $chan \" \" $who , Real men use vim!\" "
2017-05-07 15:33:35 -04:00
keywords[ sbl] = " msg \" $chan \" \" $( shuf -n1 -e\
"Oh yeah! Let's all use SBL, a CLI reader that doesn't compile or work! That's a great idea! Or, here's an idea... USE FENRIR DUMB ASS!"
"SBL, a great idea. Now here's another great idea: Skip buying a Braille display, just contract herpes, jam a usb chord up your ass, and see if the breakout patterns match what's on screen!" ) \"
2017-05-06 13:06:30 -04:00
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" "a can of wd40" ) and a $( shuf -n1 -e dead frozen live young) chicken, and $( shuf -n1 -e "have fun" "make chicks" "lay it like an egg" "put my beak where it don't belong" ) ALL NIGHT LONG!!!\" "
2016-09-06 22:35:15 -04:00
keywords[ dragonforce] = " msg \" $chan \" \" $who : I love DragonForce!!!\" "
2017-05-07 13:59:14 -04:00
keywords[ vim] = " msg \" $chan \" \" $( shuf -n1 -e \
"Praise vim! HA" \
2017-05-07 15:24:00 -04:00
"In times of trouble, just ask yourself, 'What would Bram Moolenaar do?'." \
2017-05-07 13:59:14 -04:00
"Only through vim can you be saved! HA" ) \" "
2016-09-06 14:25:46 -04:00
2016-09-06 22:35:15 -04:00
wordList = " $( echo " ${ @,, } " | tr '[:space:]' $'\n' | sort -u) "
2016-09-06 14:25:46 -04:00
for w in ${ wordList //[[ : punct : ]]/ } ; do
2017-05-06 13:06:30 -04:00
if [ [ -n " ${ keywords [ ${ w ,, } ] } " && " $lastWordMatch " != " ${ keywords [ ${ w ,, } ] } " ] ] ; then
2016-09-06 14:25:46 -04:00
eval ${ keywords [ ${ w ,, } ] }
2017-05-06 13:06:30 -04:00
lastWordMatch = " ${ keywords [ ${ w ,, } ] } "
2016-09-06 14:25:46 -04:00
fi
done
2016-09-16 22:00:59 -04:00
# Example of dealing with multi word triggers.
2016-09-25 00:25:52 -04:00
# Reset wordList without sorting it and with spaces removed.
wordList = " $( echo " ${ @,, } " | tr -d '[:space:]' ) "
if [ [ " $wordList " = ~ .*nowplaying:.*-.* ] ] ; then
2016-09-25 00:27:31 -04:00
act " $chan " " $( shuf -n1 -e "cranks the volume up to 11" "got soooo high at that show" "boogies down to the sound of the band" ) ! "
2016-09-16 22:00:59 -04:00
fi