annna-message-wikigame - annna - Annna the nice friendly bot. HTML git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/ DIR Log DIR Files DIR Refs DIR Tags DIR README --- annna-message-wikigame (741B) --- 1 #!/bin/sh -e 2 3 cfgbase="$(pwd)" 4 ircbase="$(cat ${cfgbase}/ircbase)" 5 modbase="$(cat ${cfgbase}/modbase)" 6 7 server="$1" 8 ircuser="$(cat ${cfgbase}/${server}/ircuser)" 9 channel="$2" 10 user="$3" 11 text="$4" 12 cmd="$5" 13 14 [ "$user" = "${ircuser}" ] && exit 15 16 saytext="" 17 case "${text}" in 18 init|summary|hint|more|giveup) 19 saytext="$(wikipediagame "${text}")" 20 ;; 21 "init "*) 22 inittext="$(printf "%s\n" "${text}" | cut -c 5-)" 23 saytext="$(wikipediagame init "${inittext}")" 24 ;; 25 "guess "*) 26 guesstext="$(printf "%s\n" "${text}" | cut -c 6-)" 27 saytext="$(wikipediagame guess "${guesstext}")" 28 ;; 29 esac 30 31 if [ -n "${saytext}" ]; 32 then 33 annna-say -s "${server}" -c "${channel}" "${saytext}" 34 fi 35 36 annna-message-common "${server}" "${channel}" "${user}" "${text}" "${cmd}" 37