Introduction
Introduction Statistics Contact Development Disclaimer Help
annna-message-radio - annna - Annna the nice friendly bot.
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6…
Log
Files
Refs
Tags
README
---
annna-message-radio (1917B)
---
1 #!/bin/sh -e
2
3 export PATH="/br/bin:$PATH"
4
5 cfgbase="$(pwd)"
6 ircbase="$(cat ${cfgbase}/ircbase)"
7 modbase="$(cat ${cfgbase}/modbase)"
8
9 server="$1"
10 ircuser="$(cat ${cfgbase}/${server}/ircuser)"
11 channel="$2"
12 user="$3"
13 text="$4"
14
15 [ "$user" = "${ircuser}" ] && exit
16
17 case "${text}" in
18 "${ircuser}, next song please.") /usr/bin/mpc -q next; exit;;
19 "${ircuser}, prev song please.") /usr/bin/mpc -q prev; exit;;
20 "${ircuser}, please shuffle.") /usr/bin/mpc -q shuffle; exit;;
21 "${ircuser}, please toggle random.") /usr/bin/mpc -q random; exit;;
22 "${ircuser}, please toggle single.") /usr/bin/mpc -q single; exit;;
23 "${ircuser}, please toggle consume.") /usr/bin/mpc -q consume; exit;;
24 "${ircuser}, please rescan.") /usr/bin/mpc -q rescan; exit;;
25 "${ircuser}, how many people listen to the radio?")
26 annna-say -s "${server}" -c "${channel}" "${user}, $(/br/bin/bit…
27 exit;;
28 "${ircuser}, please radio play "*)
29 url="$(printf "%s\n" "${text}" | cut -c 25- | sed 's,\t, ,g')"
30 {
31 ytdl-mpd -a -m -q "$url"
32 annna-say -s "${server}" -c "${channel}" "Your download …
33 } &
34 exit;;
35 "${ircuser}, please radio say "*)
36 word="$(printf "%s\n" "${text}" | cut -c 25- | sed 's,\t, ,g'…
37 {
38 printf "%s\n" "${word}" | bitreich-radio-speak
39 annna-say -s "${server}" -c "${channel}" "The speech is …
40 } &
41 exit;;
42 "${ircuser}, please stop speaking on radio.")
43 if pkill -f bitreich-radio-speak >/dev/null 2>&1;
44 then
45 annna-say -s "${server}" -c "${channel}" "${user}, I sto…
46 else
47 annna-say -s "${server}" -c "${channel}" "${user}, sorry…
48 fi
49 exit;;
50 "${ircuser}, please radio status.")
51 mpc_status="$(/usr/bin/mpc status | grep '\[.*\]' -o | tr -d '[]…
52 [ -z "$mpc_status" ] && mpc_status="gone"
53 annna-say -s "${server}" -c "${channel}" "The radio is ${mpc_sta…
54 exit;;
55 esac
56
57 annna-message-common "${server}" "${channel}" "${user}" "${text}"
58
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.