Add log chat to Konata

This commit is contained in:
2021-01-13 17:48:40 +01:00
parent 7df2a4b187
commit c26fa59612
2 changed files with 9 additions and 1 deletions

View File

@@ -8,6 +8,8 @@ apk add lighttpd curl jq bash youtube-dl ffmpeg
read -p "Please enter your bot token: " token
read -p "Please enter the bot's username (without @): " bot
read -p "Please enter the domain for your bot: " domain
read -p "Do you want to use a log chat? (y/n): " logans
[ ! -z $logans ] && read -p "What's the log chat's chat ID? " logchat
if [ -f /etc/konata.conf ]
then
@@ -22,6 +24,7 @@ then
else
echo "token=$token" >> /etc/konata.conf
echo "bot=$bot" >> /etc/konata.conf
[ ! -z $logchat ] && echo "logchat=$logchat" >> /etc/konata.conf
fi
echo "Installing application files..."

View File

@@ -74,9 +74,11 @@ cv(){
stats=$(curl -s "https://corona.lmao.ninja/v2/countries/$args")
country=$(jq -r '.country' <<< $stats)
cases=$(jq -r '.todayCases' <<< $stats)
pm=$(jq -r '.testsPerOneMillion' <<< $stats)
pct=$(echo "scale = 2; $pm / 10000" | bc)
if jq -re '.country' <<< $stats
then
sendmsg "Today's COVID-19 cases for $country: $cases. Stay safe!"
sendmsg "Today's COVID-19 cases for $country: $cases \($pct% of the population tested\). Stay safe!"
else
sendmsg "This country doesn't have any stats!"
fi
@@ -168,6 +170,9 @@ anyone(){
# Miscellaneous
tag(){
sendmsg "Please stand by, he'll get to your message soon™..."
local chat=$logchat
local atchat=$(sed "s/@//" <<< $chat)
sendmsg "Youv'e been tagged in [$atchat](tg://resolve?domain=$atchat): $msg"
}
# Match incoming messages