2020-12-28 03:34:15 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2020-12-31 21:23:34 +01:00
|
|
|
# Hard requirement for lighttpd
|
2020-12-28 14:42:08 +01:00
|
|
|
printf "Content-Type: text/plain\n\n"
|
2020-12-25 20:57:07 +01:00
|
|
|
|
2020-12-31 21:23:34 +01:00
|
|
|
# Initialize basic variables
|
2020-12-28 14:42:08 +01:00
|
|
|
. /etc/konata.conf
|
2020-12-25 20:57:07 +01:00
|
|
|
|
2020-12-31 21:23:34 +01:00
|
|
|
# Parse incoming messages
|
2021-01-04 16:39:50 +01:00
|
|
|
input=$(cat /dev/stdin)
|
2021-02-07 17:43:35 +01:00
|
|
|
msg=$(jq -r '.message.text' <<< $input | sed "s/_/\ /g")
|
2021-02-25 14:22:39 +01:00
|
|
|
cmd=$(cut -d" " -f1 <<< $msg)
|
2021-02-24 13:08:31 +01:00
|
|
|
args=($(cut -sd" " -f2- <<< $msg))
|
2020-12-25 20:57:07 +01:00
|
|
|
chat=$(jq -r '.message.chat.id' <<< $input)
|
2020-12-26 01:08:36 +01:00
|
|
|
user=$(jq -r '.message.from.username' <<< $input)
|
2020-12-25 20:57:07 +01:00
|
|
|
|
2021-01-04 19:09:09 +01:00
|
|
|
# Append bot's tag to any command without one
|
2021-01-09 06:08:33 +01:00
|
|
|
if ! grep -q "/.*@" <<< $cmd
|
2021-01-04 19:09:09 +01:00
|
|
|
then
|
2021-01-09 06:08:33 +01:00
|
|
|
cmd=${cmd}@$bot
|
|
|
|
fi
|
|
|
|
# Convert k.command to /command
|
|
|
|
if grep -q "k\." <<< $cmd
|
|
|
|
then
|
|
|
|
cmd=$(sed "s/k\./\//g" <<< $cmd)
|
2021-01-04 19:09:09 +01:00
|
|
|
fi
|
|
|
|
|
2020-12-31 21:23:34 +01:00
|
|
|
# Functions for outgoing messages
|
2020-12-25 20:57:07 +01:00
|
|
|
sendmsg(){
|
2021-04-19 02:52:15 +02:00
|
|
|
fmt=$(sed 's/\t//g' <<< $1)
|
2021-01-18 15:43:12 +01:00
|
|
|
curl -sX POST "https://api.telegram.org/bot$token/sendMessage" \
|
2021-04-19 02:52:15 +02:00
|
|
|
-d "chat_id=$chat" -d "parse_mode=html" \
|
2021-02-18 13:53:48 +01:00
|
|
|
-d "disable_web_page_preview=true" \
|
2021-04-19 02:52:15 +02:00
|
|
|
--data-urlencode "text=$fmt"
|
2020-12-25 20:57:07 +01:00
|
|
|
}
|
2021-03-01 11:16:26 +01:00
|
|
|
|
2021-01-13 18:23:15 +01:00
|
|
|
sendlog(){
|
|
|
|
chat=$logchat
|
|
|
|
sendmsg "$1"
|
|
|
|
}
|
2021-03-01 11:16:26 +01:00
|
|
|
|
2020-12-31 22:16:44 +01:00
|
|
|
sendfile(){
|
|
|
|
curl -sF document=@"$1" "https://api.telegram.org/bot$token/sendDocument?chat_id=$chat"
|
|
|
|
}
|
2021-03-01 11:16:26 +01:00
|
|
|
|
2021-01-09 08:46:22 +01:00
|
|
|
sendpic(){
|
2021-01-18 15:43:12 +01:00
|
|
|
curl -sX POST "https://api.telegram.org/bot$token/sendPhoto" \
|
2021-04-19 02:52:15 +02:00
|
|
|
-d "chat_id=$chat" -d "parse_mode=html" \
|
2021-01-09 08:46:22 +01:00
|
|
|
-d "photo=$1" -d "caption=$2"
|
|
|
|
}
|
2021-01-24 08:42:06 +01:00
|
|
|
|
2021-03-01 11:16:26 +01:00
|
|
|
# Internal checks
|
|
|
|
args(){
|
|
|
|
if [ -z ${args[*]} ]
|
|
|
|
then
|
|
|
|
sendmsg "Don't just click me like that. See /help@$bot for more info on how to use this bot."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
admin(){
|
|
|
|
case $user in
|
|
|
|
ghnou) true ;;
|
|
|
|
*) fail ;;
|
|
|
|
esac
|
|
|
|
debug "Admin @$user tried to execute $cmd and was approved."
|
|
|
|
}
|
|
|
|
|
|
|
|
fail(){
|
|
|
|
debug "User @$user tried to execute $cmd and was rejected."
|
|
|
|
sendmsg "Sorry, you are not allowed to use this command!"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2021-01-24 08:42:06 +01:00
|
|
|
# Debugging commands
|
2021-01-18 16:03:26 +01:00
|
|
|
debug(){
|
|
|
|
[ ! -z $debug ] && echo "[DEBUG] $1" >&2
|
|
|
|
}
|
2020-12-25 20:57:07 +01:00
|
|
|
|
2020-12-31 21:23:34 +01:00
|
|
|
# Public commands
|
2020-12-27 13:17:31 +01:00
|
|
|
help(){
|
2021-05-08 18:45:04 +02:00
|
|
|
if [ $(jq -r '.message.chat.type' <<< $input) == "private" ]
|
|
|
|
then
|
|
|
|
sendmsg "Hiya! I'm <a href=\"https://t.me/ghnou\">ghnou</a>'s personal bot, Konata.
|
|
|
|
|
|
|
|
<b>Currently I have the following features:</b>
|
|
|
|
- /help - Show this help message.
|
|
|
|
- /alive - Check whether I'm running.
|
|
|
|
- /cv [country] - Check COVID-19 stats.
|
|
|
|
- /id - Get the current chat's ID.
|
|
|
|
- /ud [term] - Get a definition from Urban Dictionary.
|
|
|
|
- /konata - Get one of my selfies :3
|
|
|
|
- /konachan [query] - Get a picture from Konachan.
|
|
|
|
- /4c [board] - Get a random image from 4chan.
|
|
|
|
- /lfy [query] - Let me look that up for you...
|
|
|
|
- /ip [address] - Get information for an IP address.
|
|
|
|
- /wttr [city] - Get the weather for a city.
|
|
|
|
- /repo - Get my source code.
|
|
|
|
|
|
|
|
And a lot more to come!"
|
|
|
|
else
|
|
|
|
sendmsg "Please ask me in <a href=\"https://t.me/$bot\">private</a>!"
|
|
|
|
fi
|
2020-12-27 13:17:31 +01:00
|
|
|
}
|
|
|
|
|
2020-12-25 20:57:07 +01:00
|
|
|
alive(){
|
2020-12-26 01:08:36 +01:00
|
|
|
sendmsg "Alive and well!"
|
|
|
|
}
|
|
|
|
|
2020-12-31 21:23:34 +01:00
|
|
|
cv(){
|
2021-03-01 11:16:26 +01:00
|
|
|
args
|
2021-04-27 17:00:52 +02:00
|
|
|
stats=$(curl -s "https://disease.sh/v3/covid-19/countries/${args[*]}")
|
2021-02-25 14:22:39 +01:00
|
|
|
mapfile -t cv <<< $(jq -cr '.[]' <<< $stats)
|
|
|
|
if [ "${cv[4]}" == "0" ]
|
2021-02-10 16:47:23 +01:00
|
|
|
then
|
|
|
|
updated="Perhaps the stats are not updated yet?"
|
|
|
|
fi
|
2021-02-25 14:22:39 +01:00
|
|
|
if [ ! -z ${cv[1]} ]
|
2021-01-01 00:03:16 +01:00
|
|
|
then
|
2021-04-26 17:03:03 +02:00
|
|
|
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)
|
|
|
|
|
2021-04-26 17:05:25 +02:00
|
|
|
pct(){ echo $(bc <<< "scale = 2; $1 * $2 / $3")%; }
|
2021-04-26 17:18:16 +02:00
|
|
|
div(){
|
|
|
|
if [ "$1" -gt "1000000" ]
|
|
|
|
then
|
|
|
|
echo $(bc <<< "scale = 3; $1 / 1000000")M
|
|
|
|
else
|
|
|
|
echo $(bc <<< "scale = 2; $1 / 1000")k
|
|
|
|
fi
|
|
|
|
}
|
2021-04-26 17:03:03 +02:00
|
|
|
|
2021-04-19 02:52:15 +02:00
|
|
|
sendmsg "<b>Today's COVID-19 stats for ${cv[1]}:</b>
|
|
|
|
<b>Cases:</b> ${cv[4]}
|
2021-04-26 17:18:16 +02:00
|
|
|
<b>Active:</b> $(div ${cv[9]})
|
2021-04-19 02:52:15 +02:00
|
|
|
<b>Deaths:</b> ${cv[6]}
|
2021-04-26 17:18:16 +02:00
|
|
|
($(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]})
|
2021-04-27 17:00:52 +02:00
|
|
|
<b>Data source:</b> <a href=\"https://disease.sh\">disease.sh</a>
|
2021-04-26 17:03:03 +02:00
|
|
|
|
|
|
|
<b>Vaccination stats:</b>
|
2021-04-27 16:21:26 +02:00
|
|
|
<b>Total coverage:</b> $(div ${vac[2]}) ($(pct 100 ${vac[2]} ${cv[15]}))
|
|
|
|
<b>Fully vaccinated:</b> $(div ${vac[3]}) ($(pct 100 ${vac[3]} ${cv[15]}))
|
2021-04-27 16:23:02 +02:00
|
|
|
<b>Administered today:</b> $(div ${vac[4]})
|
|
|
|
<b>Daily average (7d):</b> $(div ${vac[5]})
|
2021-04-26 17:03:03 +02:00
|
|
|
<b>Last update:</b> ${vac[0]}
|
2021-04-27 17:00:52 +02:00
|
|
|
<b>Data source:</b> <a href=\"https://github.com/owid/covid-19-data/tree/master/public/data/vaccinations\">Our World in Data</a>
|
2021-02-26 14:54:52 +01:00
|
|
|
|
2021-02-15 13:29:53 +01:00
|
|
|
Queried at $(date +'%Y-%m-%d %H:%M %Z').
|
2021-02-26 14:54:52 +01:00
|
|
|
Stay safe and get yourself vaccinated!
|
2021-02-10 16:47:23 +01:00
|
|
|
$updated"
|
2021-01-04 16:26:59 +01:00
|
|
|
else
|
|
|
|
sendmsg "This country doesn't have any stats!"
|
2021-01-01 00:03:16 +01:00
|
|
|
fi
|
2020-12-25 20:57:07 +01:00
|
|
|
}
|
|
|
|
|
2020-12-31 21:23:34 +01:00
|
|
|
id(){
|
2021-04-12 17:49:44 +02:00
|
|
|
uid=$(jq -r '.message.from.id' <<< $input)
|
2021-04-19 02:52:15 +02:00
|
|
|
sendmsg "<b>User ID:</b> <code>$uid</code>
|
|
|
|
<b>Chat ID:</b> <code>$chat</code>"
|
2020-12-31 21:23:34 +01:00
|
|
|
}
|
|
|
|
|
2021-01-04 15:51:53 +01:00
|
|
|
ud(){
|
2021-03-01 11:16:26 +01:00
|
|
|
args
|
2021-02-07 15:09:36 +01:00
|
|
|
enc=$(echo "${args[*]}" | sed "s/\ /%20/g")
|
2021-01-18 15:43:12 +01:00
|
|
|
res=$(curl -s "https://api.urbandictionary.com/v0/define?term=$enc")
|
2021-01-04 16:26:59 +01:00
|
|
|
if jq -re '.list[0].definition' <<< $res
|
|
|
|
then
|
|
|
|
def=$(jq -r '.list[0].definition' <<< $res | sed "s/[][]//g")
|
|
|
|
sam=$(jq -r '.list[0].example' <<< $res | sed "s/[][]//g")
|
2021-04-19 02:52:15 +02:00
|
|
|
sendmsg "<b>Definition for <u>${args[*]}</u>:</b>
|
|
|
|
$def
|
2021-04-11 22:11:25 +02:00
|
|
|
|
2021-04-19 02:52:15 +02:00
|
|
|
<b>Example:</b>
|
|
|
|
$sam"
|
2021-01-04 16:26:59 +01:00
|
|
|
else
|
2021-02-07 15:09:36 +01:00
|
|
|
sendmsg "No definition found for ${args[*]}."
|
2021-01-04 16:26:59 +01:00
|
|
|
fi
|
2021-01-04 15:51:53 +01:00
|
|
|
}
|
|
|
|
|
2021-01-09 08:46:22 +01:00
|
|
|
konata(){
|
2021-02-17 00:16:10 +01:00
|
|
|
args="izumi_konata"
|
|
|
|
konachan
|
|
|
|
}
|
|
|
|
|
|
|
|
konachan(){
|
2021-03-01 11:16:26 +01:00
|
|
|
args
|
2021-02-17 00:16:10 +01:00
|
|
|
query=$(sed "s/\ /_/g" <<< ${args[*]})
|
|
|
|
data=$(curl -s "https://konachan.net/post.json?limit=1&page=1&tags=order:random%20$query")
|
2021-01-09 08:46:22 +01:00
|
|
|
jpeg=$(jq -r '.[0].jpeg_url' <<< $data)
|
|
|
|
file=$(jq -r '.[0].file_url' <<< $data)
|
|
|
|
sfw=$(jq -r '.[0].rating' <<< $data)
|
|
|
|
if [ $sfw == "s" ]
|
|
|
|
then
|
2021-04-19 02:52:15 +02:00
|
|
|
sendpic "$jpeg" "<a href=\"$file\">sauce</a>"
|
2021-02-17 00:16:10 +01:00
|
|
|
elif [ $sfw == "q" ] || [ $sfw == "x" ]
|
|
|
|
then
|
2021-04-19 02:52:15 +02:00
|
|
|
sendmsg "This picture appears to be NSFW! Here's the <a href=\"$file\">sauce</a>."
|
2021-02-17 00:16:10 +01:00
|
|
|
else
|
|
|
|
sendmsg "No data!"
|
2021-01-09 08:46:22 +01:00
|
|
|
fi
|
|
|
|
}
|
2021-02-07 17:12:19 +01:00
|
|
|
|
|
|
|
4c(){
|
2021-03-01 11:16:26 +01:00
|
|
|
args
|
2021-02-07 17:12:19 +01:00
|
|
|
tmp="/tmp/4chan"
|
|
|
|
json="$tmp/${args[0]}.json"
|
|
|
|
[ ! -d $tmp ] && mkdir $tmp
|
|
|
|
[ $(find $json -mmin +60) ] && rm $json
|
|
|
|
[ ! -f $json ] && wget -O $json https://a.4cdn.org/${args[0]}/threads.json
|
|
|
|
thread=$(jq -r '.[].threads[].no' < $json | shuf | head -n1)
|
2021-02-17 00:16:10 +01:00
|
|
|
img=$(curl -s https://a.4cdn.org/${args[0]}/thread/$thread.json | jq -r '.posts[].tim' | shuf | head -n1)
|
2021-02-07 17:12:19 +01:00
|
|
|
url="https://i.4cdn.org/${args[0]}/$img"
|
|
|
|
# TODO: Try to determine from JSON output whether image is PNG or JPG.
|
|
|
|
sendpic "$url.jpg"
|
|
|
|
sendpic "$url.png"
|
|
|
|
}
|
|
|
|
|
2021-02-18 13:53:48 +01:00
|
|
|
lfy(){
|
2021-03-01 11:16:26 +01:00
|
|
|
args
|
2021-02-18 13:53:48 +01:00
|
|
|
query=$(sed "s/\ /+/g" <<< ${args[*]})
|
2021-04-19 02:52:15 +02:00
|
|
|
sendmsg "<a href=\"https://lmgtfy.app/?s=d&iee=1&q=$query\">Let me look that up for you</a>"
|
2021-02-18 13:53:48 +01:00
|
|
|
}
|
|
|
|
|
2021-02-24 13:08:31 +01:00
|
|
|
ip(){
|
2021-03-01 11:16:26 +01:00
|
|
|
args
|
|
|
|
ip=${args[0]}
|
|
|
|
res=$(curl -s http://ip-api.com/json/$ip)
|
|
|
|
# See https://0x0.st/Nlc0 for reference.
|
|
|
|
mapfile -t data <<< $(jq -cr '.[]' <<< $res)
|
2021-04-19 02:52:15 +02:00
|
|
|
sendmsg "<b>IP information for $ip:</b>
|
|
|
|
<b>Country:</b> ${data[1]}
|
|
|
|
<b>Region:</b> ${data[4]}
|
|
|
|
<b>City:</b> ${data[6]} ${data[5]}
|
|
|
|
<b>ISP:</b> ${data[10]}
|
|
|
|
<b>ASN:</b> ${data[12]}
|
|
|
|
<b>Time:</b> $(TZ=${data[9]} date +'%H:%M %Z')"
|
2021-02-24 13:08:31 +01:00
|
|
|
}
|
|
|
|
|
2021-05-08 18:15:43 +02:00
|
|
|
wttr(){
|
|
|
|
args
|
|
|
|
res=$(curl wttr.in/${args[0]}?format=3)
|
|
|
|
sendmsg "$res"
|
|
|
|
}
|
|
|
|
|
2021-01-19 16:07:01 +01:00
|
|
|
repo(){
|
2021-04-21 01:34:02 +02:00
|
|
|
sendmsg "You can find my source code <a href=\"https://git.nixmagic.com/ghnou/konata\">here</a>."
|
2021-01-19 16:07:01 +01:00
|
|
|
}
|
2021-01-09 08:46:22 +01:00
|
|
|
|
2021-01-14 22:14:57 +01:00
|
|
|
# Administrative
|
2020-12-31 22:16:44 +01:00
|
|
|
mp3(){
|
2021-01-01 00:32:33 +01:00
|
|
|
admin
|
2021-03-01 11:16:26 +01:00
|
|
|
args
|
2020-12-31 22:16:44 +01:00
|
|
|
tmp="/tmp/mp3"
|
2021-02-07 10:43:27 +01:00
|
|
|
[ ! -d $tmp ] && mkdir $tmp
|
2020-12-31 22:16:44 +01:00
|
|
|
sendmsg "Downloading, this might take a while..."
|
2021-02-07 15:09:36 +01:00
|
|
|
youtube-dl -f 140 --max-filesize 50M -o "$tmp/%(title)s.%(ext)s" "${args[*]}"
|
2021-01-02 17:42:10 +01:00
|
|
|
rm $tmp/*.part
|
|
|
|
if [ -f $tmp/* ]
|
|
|
|
then
|
|
|
|
sendfile "$tmp/$(ls $tmp)"
|
|
|
|
rm $tmp/*
|
|
|
|
else
|
|
|
|
sendmsg "I couldn't download this file. Perhaps it's too large?"
|
|
|
|
fi
|
2020-12-31 22:16:44 +01:00
|
|
|
}
|
|
|
|
|
2021-03-28 18:34:59 +02:00
|
|
|
sys(){
|
2020-12-26 12:32:10 +01:00
|
|
|
admin
|
2021-03-28 18:34:59 +02:00
|
|
|
mtot=$(grep MemTotal /proc/meminfo | awk '{print $2}')
|
|
|
|
mavl=$(grep MemAvailable /proc/meminfo | awk '{print $2}')
|
|
|
|
mem=$(bc <<< "scale=1; ($mtot-$mavl) / 1024")
|
|
|
|
ups=$(cut -d. -f1 < /proc/uptime)
|
|
|
|
upd=$(bc <<< "$ups / 60 / 60 / 24")
|
|
|
|
disk=$(df -h / | tail -n1 | awk '{print $3}')
|
2021-04-06 15:56:11 +02:00
|
|
|
kernel=$(uname -r)
|
2021-03-28 18:34:59 +02:00
|
|
|
load=$(cut -d' ' -f1,2,3 < /proc/loadavg)
|
2021-04-19 02:52:15 +02:00
|
|
|
sendmsg "<b>System usage stats:</b>
|
|
|
|
<b>Memory:</b> ${mem}M
|
|
|
|
<b>Disk:</b> ${disk}
|
|
|
|
<b>Kernel:</b> ${kernel}
|
|
|
|
<b>Uptime:</b> ${upd}d
|
|
|
|
<b>Load:</b> ${load}"
|
2020-12-26 01:08:36 +01:00
|
|
|
}
|
|
|
|
|
2021-03-22 22:17:09 +01:00
|
|
|
neo(){
|
|
|
|
admin
|
2021-04-19 02:52:15 +02:00
|
|
|
sendmsg "<code>$(neofetch --stdout)</code>"
|
2021-03-22 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
2021-03-28 18:39:37 +02:00
|
|
|
sh(){
|
2020-12-27 13:17:31 +01:00
|
|
|
admin
|
2021-04-19 02:52:15 +02:00
|
|
|
sendmsg "<code>$(whoami)@${HOSTNAME}:${PWD}$</code> <code>${args[*]}</code>
|
|
|
|
<code>$(echo ${args[*]} | bash - 2>&1)</code>"
|
2020-12-27 13:17:31 +01:00
|
|
|
}
|
2021-05-08 19:12:24 +02:00
|
|
|
dump(){
|
|
|
|
admin
|
|
|
|
out=/tmp/$RANDOM.json
|
|
|
|
jq <<< "$input" > $out
|
|
|
|
sendmsg "Event saved to $out."
|
|
|
|
}
|
2020-12-27 13:17:31 +01:00
|
|
|
|
2020-12-31 21:23:34 +01:00
|
|
|
# Notes and such
|
2020-12-31 17:53:29 +01:00
|
|
|
anyone(){
|
2021-04-19 02:52:15 +02:00
|
|
|
sendmsg "Quite possibly. <a href=\"https://dontasktoask.com\">Why do you ask?</a>"
|
2020-12-31 17:53:29 +01:00
|
|
|
}
|
|
|
|
|
2020-12-31 21:23:34 +01:00
|
|
|
# Miscellaneous
|
2020-12-27 13:26:26 +01:00
|
|
|
tag(){
|
2021-04-11 20:48:30 +02:00
|
|
|
chid=$(jq -r '.message.chat.id' <<< $input | sed 's/-100//')
|
|
|
|
msgid=$(jq -r '.message.message_id' <<< $input)
|
2021-05-02 22:07:09 +02:00
|
|
|
name=$(jq -r '.message.from.first_name' <<< $input)
|
2021-04-11 20:48:30 +02:00
|
|
|
uid=$(jq -r '.message.from.id' <<< $input)
|
|
|
|
text=$(jq -r '.message.text' <<< $input)
|
2021-04-19 02:52:15 +02:00
|
|
|
sendlog "<b>You've been tagged.</b>
|
2021-05-02 22:07:09 +02:00
|
|
|
<b>User:</b> <a href=\"tg://user?id=$uid\">$name</a>
|
2021-04-19 02:52:15 +02:00
|
|
|
<b>Link:</b> <a href=\"https://t.me/c/$chid/$msgid\">here</a>
|
|
|
|
<b>Message contents:</b>
|
|
|
|
$text"
|
2020-12-27 13:26:26 +01:00
|
|
|
}
|
2021-03-02 09:23:58 +01:00
|
|
|
hiya(){
|
|
|
|
sendmsg "Hiya! :3"
|
|
|
|
}
|
2020-12-27 13:26:26 +01:00
|
|
|
|
2020-12-31 21:23:34 +01:00
|
|
|
# Match incoming messages
|
2020-12-25 20:57:07 +01:00
|
|
|
case "$cmd" in
|
2020-12-31 21:23:34 +01:00
|
|
|
# Public commands
|
2021-01-04 19:09:09 +01:00
|
|
|
/help@$bot) help ;;
|
|
|
|
/start@$bot) help ;;
|
|
|
|
/alive@$bot) alive ;;
|
|
|
|
/cv@$bot*) cv ;;
|
|
|
|
/id@$bot) id ;;
|
|
|
|
/ud@$bot*) ud ;;
|
2021-02-18 13:53:48 +01:00
|
|
|
/konata@$bot) konata ;;
|
2021-02-17 00:16:10 +01:00
|
|
|
/konachan@$bot*) konachan ;;
|
2021-02-07 17:12:19 +01:00
|
|
|
/4c@$bot*) 4c ;;
|
2021-02-18 13:53:48 +01:00
|
|
|
/lfy@$bot*) lfy ;;
|
2021-02-24 13:08:31 +01:00
|
|
|
/ip@$bot*) ip ;;
|
2021-05-08 18:15:43 +02:00
|
|
|
/wttr@$bot*) wttr ;;
|
2021-01-19 16:07:01 +01:00
|
|
|
/repo@$bot) repo ;;
|
2021-01-14 22:14:57 +01:00
|
|
|
# Administrative
|
2021-01-04 19:09:09 +01:00
|
|
|
/mp3@$bot*) mp3 ;;
|
2021-03-28 18:34:59 +02:00
|
|
|
/sys@$bot) sys ;;
|
2021-03-22 22:17:09 +01:00
|
|
|
/neo@$bot) neo ;;
|
2021-03-28 18:39:37 +02:00
|
|
|
/sh@$bot*) sh ;;
|
2021-05-08 19:12:24 +02:00
|
|
|
/dump@$bot*) dump ;;
|
2020-12-31 21:23:34 +01:00
|
|
|
# Notes and such
|
2021-01-06 20:00:01 +01:00
|
|
|
!anyone*) anyone ;;
|
2021-02-04 19:36:56 +01:00
|
|
|
esac
|
|
|
|
|
|
|
|
case "$msg" in
|
2020-12-31 21:23:34 +01:00
|
|
|
# Miscellaneous
|
2020-12-27 13:26:26 +01:00
|
|
|
*@ghnou*) tag ;;
|
2021-03-02 09:23:58 +01:00
|
|
|
*Konata*) hiya ;;
|
2020-12-25 20:57:07 +01:00
|
|
|
esac
|