Introduction
Introduction Statistics Contact Development Disclaimer Help
brcon-countdown - annna - Annna the nice friendly bot.
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6…
Log
Files
Refs
Tags
README
---
brcon-countdown (1883B)
---
1 #!/bin/sh
2
3 PATH="$HOME/bin:$PATH"
4
5 announcechannels="#bitreich-en #bitreich-con irc.libera.chat/#gopherproj…
6 schedulebase="/br/gopher/con/%s/index.gph"
7
8 function announce {
9 announcechannels="$1"
10 announcestr="$2"
11
12 #echo "$announcestr"
13 annna-say -c "${announcechannels}" "${announcestr}"
14 }
15
16 if [ $# -gt 0 ];
17 then
18 curdate="$1T00:00:00"
19 else
20 curdate="$(date +%Y-%m-%d -d "00:00:00")"
21 fi
22
23 year="$(date +%Y -d "${curdate}")"
24 schedule="$(printf "${schedulebase}" "${year}")"
25
26 days="$(grep -E "^${year}-[0-9]{2}-[0-9]{2} - " "${schedule}" | cut -d' …
27 fromdate="$(printf "%s\n" "${days}" | head -n 1)"
28 todate="$(printf "%s\n" "${days}" | tail -n 1)"
29
30 daysuntil=$((($(date +%s -d "${fromdate}T00:00:00") - $(date +%s -d "${c…
31 if [ $daysuntil -gt 0 ];
32 then
33 case "$daysuntil" in
34 1)
35 daysstr="$(int2bit ${daysuntil}) day"
36 ;;
37 *)
38 daysstr="$(int2bit ${daysuntil}) days"
39 ;;
40 esac
41 announce "${announcechannels}" \
42 "$(printf "%s until bitreichcon! gophers://bitreich.org/…
43 "${daysstr}" "${year}")"
44 exit 0
45 fi
46
47 dayssince=$((($(date +%s -d "${curdate}") - $(date +%s -d "${todate}T00:…
48 if [ $dayssince -gt 0 ];
49 then
50 [ $dayssince -gt 10 ] && exit 0
51
52 case "$dayssince" in
53 1)
54 daysstr="$(int2bit ${dayssince}) day"
55 ;;
56 *)
57 daysstr="$(int2bit ${dayssince}) days"
58 ;;
59 esac
60
61 announce "${announcechannels}" \
62 "$(printf "It has been %s since bitreichcon. Are you sti…
63 "${daysstr}")"
64 exit 0
65 fi
66
67 conferenceday=$((($(date +%s -d "${curdate}") - $(date +%s -d "${fromdat…
68 daytopic="$(grep -E "^$(date +%Y-%m-%d -d"${curdate}") - " "${schedule}"…
69 announce "${announcechannels}" \
70 "$(printf "Welcome to bitreichcon %s day %s ( %s )! Schedule: go…
71 "${year}" "$(int2bit ${conferenceday})" "${daytopic}" "${year}")"
72
73 exit 0
74
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.