|
| 1 | +#!/bin/bash |
| 2 | +if [ "$(type)" = "PRIVMSG" ] && [ "$(dest chan)" ]; then |
| 3 | + if [ "$(text | awk '{print $1}')" = "what" ] && [ "$(text | awk '{print $2}')" = "is" ]; then |
| 4 | + line=$(cat stuff | grep -i "info:$(text | awk '{print $3}' | sed -e 's/?//')") |
| 5 | + if [ ! "$line" ]; then |
| 6 | + notice $(nick) "Sorry, no definition for $(text | awk '{print $3}') exists." |
| 7 | + else |
| 8 | + echo "$line" > /tmp/shit |
| 9 | + x= |
| 10 | + while read shit; do |
| 11 | + msg $(dest) "${shit#* }" |
| 12 | + done < /tmp/shit |
| 13 | + fi |
| 14 | + elif [ "$(text | awk '{print $1}')" = "what" ] && [ "$(text | awk '{print $2}')" = "are" ]; then |
| 15 | + line=$(cat stuff | grep -i "info:$(text | awk '{print $3}' | sed -e 's/?//')") |
| 16 | + if [ ! "$line" ]; then |
| 17 | + notice $(nick) "Sorry, no definition for $(text | awk '{print $3}') exists." |
| 18 | + else |
| 19 | + echo "$line" > /tmp/shit |
| 20 | + while read shit; do |
| 21 | + msg $(dest) "${shit#* }" |
| 22 | + done < /tmp/shit |
| 23 | + fi |
| 24 | + elif [ "$(text | awk '{print $2}')" = "is" ]; then |
| 25 | + |
| 26 | + stuff=$(sed -e "s/info:$(text | awk '{print $2}') \(.*\)/info:$(text | awk '{print $2}') $(text)/" "stuff") |
| 27 | + if [ ! "$(cat stuff | grep -i "info:$(text | awk '{print $1}')")" ]; then |
| 28 | + echo "info:$(text | awk '{print $1}') $(text)" >> stuff |
| 29 | + else |
| 30 | + stuff=$(sed -e "s/info:$(text | awk '{print $2}') \(.*\)/info:$(text | awk '{print $2}') $(text)/" "stuff" > .stuff) |
| 31 | + mv .stuff stuff |
| 32 | + fi |
| 33 | + notice $(nick) "Added definition" |
| 34 | + elif [ "$(text | awk '{print $2}')" = "are" ]; then |
| 35 | + |
| 36 | + stuff=$(sed -e "s/info:$(text | awk '{print $2}') \(.*\)/info:$(text | awk '{print $2}') $(text)/" "stuff") |
| 37 | + if [ ! "$(cat stuff | grep -i "info:$(text | awk '{print $1}')")" ]; then |
| 38 | + echo "info:$(text | awk '{print $1}') $(text)" >> stuff |
| 39 | + else |
| 40 | + stuff=$(sed -e "s/info:$(text | awk '{print $2}') \(.*\)/info:$(text | awk '{print $2}') $(text)/" "stuff" > .stuff) |
| 41 | + mv .stuff stuff |
| 42 | + fi |
| 43 | + notice $(nick) "Added definition" |
| 44 | + fi |
| 45 | +fi |
0 commit comments