Remove COVID-19 code

dev
Michael De Roover 2024-03-22 04:20:56 +01:00
parent 1e9e0386f9
commit e19a81b331
Signed by: vim
GPG Key ID: 075496E232CE04CB
1 changed files with 21 additions and 77 deletions

View File

@ -151,61 +151,6 @@ alive(){
sendmsg "Alive and well!"
}
cv(){
args
stats=$(curl -s "https://disease.sh/v3/covid-19/countries/${args[*]}")
mapfile -t cv <<< $(jq -cr '.[]' <<< $stats)
if [ "${cv[4]}" == "0" ]
then
updated="Perhaps the stats are not updated yet?"
fi
if [ ! -z ${cv[1]} ]
then
vacf="/tmp/$(date +"%Y-%m-%d")-vaccinations.json"
vacd="https://github.com/owid/covid-19-data/blob/master/public/data/vaccinations/vaccinations.json?raw=true"
if [ ! -f $vacf ]
then
wget -O $vacf $vacd
fi
mapfile -t vac <<< $(jq -cr ".[] | select(.country==\"${cv[1]}\") | .data[-1] | .[]" < $vacf)
pct(){ echo $(bc <<< "scale = 2; $1 * $2 / $3")%; }
div(){
if [ "$1" -gt "1000000" ]
then
echo $(bc <<< "scale = 3; $1 / 1000000")M
else
echo $(bc <<< "scale = 2; $1 / 1000")k
fi
}
sendmsg "<b>Today's COVID-19 stats for ${cv[1]}:</b>
<b>Cases:</b> ${cv[4]}
<b>Active:</b> $(div ${cv[9]})
<b>Deaths:</b> ${cv[6]}
($(div ${cv[5]}) t, $(pct 100 ${cv[5]} ${cv[3]}) c, $(pct 100 ${cv[5]} ${cv[15]}) p)
<b>Total:</b> $(div ${cv[3]}) ($(pct 1 ${cv[11]} 10000))
<b>Tests:</b> $(div ${cv[13]}) ($(pct 1 ${cv[14]} 10000))
<b>Population:</b> $(div ${cv[15]})
<b>Data source:</b> <a href=\"https://disease.sh\">disease.sh</a>
<b>Vaccination stats:</b>
<b>1st dose (part):</b> $(div ${vac[2]}) ($(pct 100 ${vac[2]} ${cv[15]}))
<b>2nd dose (full):</b> $(div ${vac[3]}) ($(pct 100 ${vac[3]} ${cv[15]}))
<b>3rd dose (boost):</b> $(div ${vac[4]}) ($(pct 100 ${vac[4]} ${cv[15]}))
<b>Administered today:</b> $(div ${vac[5]})
<b>Daily average (7d):</b> $(div ${vac[6]})
<b>Last update:</b> ${vac[0]}
<b>Data source:</b> <a href=\"https://github.com/owid/covid-19-data/tree/master/public/data/vaccinations\">Our World in Data</a>
Queried at $(date +'%Y-%m-%d %H:%M %Z').
Stay safe and get yourself vaccinated!
$updated"
else
sendmsg "This country doesn't have any stats!"
fi
}
id(){
uid=$(jq -r '.message.from.id' <<< $input)
sendmsg "<b>User ID:</b> <code>$uid</code>
@ -403,32 +348,31 @@ hack(){
# Match incoming messages
case "$cmd" in
# Public commands
/help@$bot) help ;;
/start@$bot) help ;;
/alive@$bot) alive ;;
/cv@$bot*) cv ;;
/id@$bot) id ;;
/ud@$bot*) ud ;;
/konata@$bot) konata ;;
/konachan@$bot*) konachan ;;
/4c@$bot*) 4c ;;
/lfy@$bot*) lfy ;;
/ip@$bot*) ip ;;
/wttr@$bot*) wttr ;;
/repo@$bot) repo ;;
/help@$bot) help ;;
/start@$bot) help ;;
/alive@$bot) alive ;;
/id@$bot) id ;;
/ud@$bot*) ud ;;
/konata@$bot) konata ;;
/konachan@$bot*) konachan ;;
/4c@$bot*) 4c ;;
/lfy@$bot*) lfy ;;
/ip@$bot*) ip ;;
/wttr@$bot*) wttr ;;
/repo@$bot) repo ;;
# Administrative
/mp3@$bot*) mp3 ;;
/sys@$bot) sys ;;
/neo@$bot) neo ;;
/sh@$bot*) sh ;;
/dump@$bot*) dump ;;
/mp3@$bot*) mp3 ;;
/sys@$bot) sys ;;
/neo@$bot) neo ;;
/sh@$bot*) sh ;;
/dump@$bot*) dump ;;
# Notes and such
!anyone*) anyone ;;
!anyone*) anyone ;;
esac
case "$msg" in
# Miscellaneous
*@vimicito*) tag ;;
Konata\ say*) say ;;
*hack*) hack ;;
*@vimicito*) tag ;;
Konata\ say*) say ;;
*hack*) hack ;;
esac