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