annna-message-radio - 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-radio (1556B)
---
1 #!/bin/sh -e
2
3 [ "$IRC_CMD_USER" = "${IRC_USER}" ] && exit
4
5 case "${IRC_PRIVMSG_TEXT}" in
6 "${IRC_USER}, next song please.") /usr/bin/mpc -q next; exit;;
7 "${IRC_USER}, prev song please.") /usr/bin/mpc -q prev; exit;;
8 "${IRC_USER}, please shuffle.") /usr/bin/mpc -q shuffle; exit;;
9 "${IRC_USER}, please toggle random.") /usr/bin/mpc -q random; exit;;
10 "${IRC_USER}, please toggle single.") /usr/bin/mpc -q single; exit;;
11 "${IRC_USER}, please toggle consume.") /usr/bin/mpc -q consume; exit;;
12 "${IRC_USER}, please rescan.") /usr/bin/mpc -q rescan; exit;;
13 "${IRC_USER}, how many people listen to the radio?")
14 annna-say "${IRC_CMD_USER}, $(/br/bin/bitreich-radio-listener-count)"
15 exit;;
16 "${IRC_USER}, please radio play "*)
17 url="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 25- | sed 's,\t, ,g')"
18 {
19 ytdl-mpd -a -m -q "$url"
20 annna-say "Your download ${url} is done."
21 } &
22 exit;;
23 "${IRC_USER}, please radio say "*)
24 word="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | cut -c 25- | sed 's,\t, ,g')"
25 {
26 printf "%s\n" "${word}" | bitreich-radio-speak
27 annna-say "The speech is done."
28 } &
29 exit;;
30 "${IRC_USER}, please stop speaking on radio.")
31 if pkill -f bitreich-radio-speak >/dev/null 2>&1;
32 then
33 annna-say "${IRC_CMD_USER}, I stopped speaking."
34 else
35 annna-say "${IRC_CMD_USER}, sorry, no instances found."
36 fi
37 exit;;
38 "${IRC_USER}, please radio status.")
39 mpc_status="$(/usr/bin/mpc status | grep '\[.*\]' -o | tr -d '[]')"
40 [ -z "$mpc_status" ] && mpc_status="gone"
41 annna-say "The radio is ${mpc_status}."
42 exit;;
43 esac
44
45 annna-message-common
46