stormbot/triggers/keywords/keywords.sh

84 lines
4.0 KiB
Bash
Raw Normal View History

2016-09-06 14:25:46 -04:00
[ -f functions.sh ] && source functions.sh
who="${1%!*}"
who="${who//:}"
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.
# 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)!\""
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.")!\""
keywords[emacs]="msg \"$chan\" \"$who, Real men of genius use vim!\""
keywords[eloquence]="msg \"$chan\" \"$(shuf -n1 -e \
"anticaesure" \
"caesure" \
2020-07-23 01:16:57 -04:00
"Goodhesville" \
"hh've" \
2020-07-23 01:16:57 -04:00
"Hoobhestank" \
"tzsche" \
"uncosp" \
"webhesday" \
"wedhesday")\""
keywords[eloquents]="msg \"$chan\" \"$(shuf -n1 -e \
"anticaesure" \
"caesure" \
"hh've" \
"tzsche" \
"uncosp" \
"webhesday" \
"wedhesday")\""
keywords[jaws]="msg \"$chan\" \"$(shuf -n1 -e \
"${who}: watch out for sharks!"\
"Ooooo! Jaws! Yeah, let's spend 1,500 bucks to buy what NVDA can do for free... Not much of an accountant are you ${who}?")\""
keywords[jfw]="msg \"$chan\" JFW: Acronym that means: Jaws! FUCKING WORTHLESS!"
keywords[emacspeak]="msg \"$chan\" \"$who, Real men of genius use vim!\""
keywords[nano]="msg \"$chan\" \"$who, Real men of genius use vim!\""
keywords[pidgin]="msg \"$chan\" \"$who, Real men of genius use irssi!\""
keywords[weechat]="msg \"$chan\" \"$who, Real men of genius use irssi!\""
keywords[thunderbird]="msg \"$chan\" \"$who, Real dogs use mutt, real men of genius use cat on a mailbox file!\""
keywords[gedit]="msg \"$chan\" \"$who, Real men of genius use vim!\""
keywords[pluma]="msg \"$chan\" \"$who, Real men of genius use vim!\""
2017-05-13 07:02:53 -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 baby) 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!!!\""
keywords[feather]="msg \"$chan\" \"$who: Erotic is using a feather. Kinky is using the whole chicken!!!\""
2020-04-20 18:12:16 -04:00
keywords[feathers]="msg \"$chan\" \"$who: Erotic is using a feather. Kinky is using the whole chicken!!!\""
keywords[dragonforce]="msg \"$chan\" \"$who: I love DragonForce!!!\""
keywords[vim]="msg \"$chan\" \"$(shuf -n1 -e \
"Praise vim! HA"\
"In times of trouble, just ask yourself, 'What would Bram Moolenaar do?'."\
2017-05-08 08:24:55 -04:00
"Vim is like a Ferrari, if you're a beginner, it handles like a bitch, but once you get the hang of it, it's small, powerful and FAST!"\
"VIM is like a new model Ferrari, and sounds like one too - 'VIIIIIIMMM!'"\
"Only through vim can you be saved! HA")\""
2016-09-06 14:25:46 -04:00
wordList="$(echo "${@,,}" | tr '[:space:]' $'\n' | sort -u)"
2016-09-06 14:25:46 -04:00
for w in ${wordList//[[:punct:]]/} ; do
if [[ -n "${keywords[${w,,}]}" && "$lastWordMatch" != "${keywords[${w,,}]}" ]]; then
2016-09-06 14:25:46 -04:00
eval ${keywords[${w,,}]}
lastWordMatch="${keywords[${w,,}]}"
2016-09-06 14:25:46 -04:00
fi
done
# Example of dealing with multi word triggers.
# Reset wordList without sorting it and with spaces removed.
wordList="$(echo "${@,,}" | tr -d '[:space:]')"
if [[ "$wordList" =~ .*nowplaying:.*-.* ]]; then
if [ "$who" = "lilmike" ]; then
msg "$chan" "Ewww, it sounds like 2 robots making out!"
else
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")!"
fi
fi