Introduction
Introduction Statistics Contact Development Disclaimer Help
annna-add-hashtag-git - annna - Annna the nice friendly bot.
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6…
Log
Files
Refs
Tags
README
---
annna-add-hashtag-git (952B)
---
1 #!/bin/sh
2
3 export PATH="$PATH:/home/annna/bin"
4
5 gitdir="/home/annna/bin"
6
7 {
8 if [ $# -eq 2 ];
9 then
10 printf "%s %s\n" "${1} ${2}"
11 elif [ $# -eq 1 ];
12 then
13 printf "%s\n"
14 else
15 cat
16 fi
17 } \
18 | while read -r line;
19 do
20 [ "$line" = "meme" ] && continue
21 [ "$line" = "meme2" ] && continue
22 [ -z "$line" ] && continue
23
24 key="$(printf "%s\n" "${line}" | cut -d' ' -f 1)"
25 value="$(printf "%s\n" "${line}" | cut -d' ' -f 2)"
26
27 taguri="$(annna-get-hashtag-uri "${key}")"
28
29 if [ -z "${taguri}" ];
30 then
31 printf "Adding %s = %s\n" "${key}" "${value}"
32
33 annna-add-hashtag "${key}" "${value}" >&2 >/dev/null
34 [ $? -gt 0 ] && continue
35 git -C "$gitdir" commit -a -m "Adding ${key} tag." >&2 >…
36 git -C "$gitdir" push >&2 >/dev/null
37
38 taguri="$(annna-get-hashtag-uri "${key}")"
39 if [ -n "${taguri}" ];
40 then
41 annna-say -c '#bitreich-meme' "Enjoy this new me…
42 fi
43 else
44 printf "%s already in db.\n" "${key}"
45 fi
46
47 sleep 2
48 done
49
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.