Remove fdebug function

This commit is contained in:
2021-02-03 13:22:29 +01:00
parent c0cb2dc908
commit ca91cf2c0c

View File

@@ -53,16 +53,12 @@ sendpic(){
} }
# Debugging commands # Debugging commands
fdebug(){
debug "Entered function $1()."
}
debug(){ debug(){
[ ! -z $debug ] && echo "[DEBUG] $1" >&2 [ ! -z $debug ] && echo "[DEBUG] $1" >&2
} }
# Public commands # Public commands
help(){ help(){
fdebug "help"
sendmsg "Hiya! I'm [ghnou](https://t.me/ghnou)'s personal bot, Konata. sendmsg "Hiya! I'm [ghnou](https://t.me/ghnou)'s personal bot, Konata.
Currently I have the following features: Currently I have the following features:
- /help - Show this help message. - /help - Show this help message.
@@ -81,12 +77,10 @@ help(){
} }
alive(){ alive(){
fdebug "alive"
sendmsg "Alive and well!" sendmsg "Alive and well!"
} }
cv(){ cv(){
fdebug "cv"
stats=$(curl -s "https://corona.lmao.ninja/v2/countries/$args") stats=$(curl -s "https://corona.lmao.ninja/v2/countries/$args")
country=$(jq -r '.country' <<< $stats) country=$(jq -r '.country' <<< $stats)
cases=$(jq -r '.todayCases' <<< $stats) cases=$(jq -r '.todayCases' <<< $stats)
@@ -101,12 +95,10 @@ cv(){
} }
id(){ id(){
fdebug "id"
sendmsg "Chat ID: $chat" sendmsg "Chat ID: $chat"
} }
ud(){ ud(){
fdebug "ud"
enc=$(echo "$args" | sed "s/\ /%20/g") enc=$(echo "$args" | sed "s/\ /%20/g")
res=$(curl -s "https://api.urbandictionary.com/v0/define?term=$enc") res=$(curl -s "https://api.urbandictionary.com/v0/define?term=$enc")
if jq -re '.list[0].definition' <<< $res if jq -re '.list[0].definition' <<< $res
@@ -123,7 +115,6 @@ ud(){
} }
konata(){ konata(){
fdebug "konata"
data=$(curl -s "https://konachan.net/post.json?limit=1&page=1&tags=order:random%20izumi_konata") data=$(curl -s "https://konachan.net/post.json?limit=1&page=1&tags=order:random%20izumi_konata")
jpeg=$(jq -r '.[0].jpeg_url' <<< $data) jpeg=$(jq -r '.[0].jpeg_url' <<< $data)
file=$(jq -r '.[0].file_url' <<< $data) file=$(jq -r '.[0].file_url' <<< $data)
@@ -136,14 +127,12 @@ konata(){
fi fi
} }
repo(){ repo(){
fdebug "repo"
sendmsg "You can find my source code [here](https://git.ghnou.su/ghnou/konata)." sendmsg "You can find my source code [here](https://git.ghnou.su/ghnou/konata)."
} }
# Administrative # Administrative
mp3(){ mp3(){
admin admin
fdebug "mp3"
tmp="/tmp/mp3" tmp="/tmp/mp3"
[ -d $tmp ] && mkdir $tmp [ -d $tmp ] && mkdir $tmp
sendmsg "Downloading, this might take a while..." sendmsg "Downloading, this might take a while..."
@@ -160,7 +149,6 @@ mp3(){
stat(){ stat(){
admin admin
fdebug "stat"
total=$(grep MemTotal /proc/meminfo | awk '{print $2}') total=$(grep MemTotal /proc/meminfo | awk '{print $2}')
avail=$(grep MemAvailable /proc/meminfo | awk '{print $2}') avail=$(grep MemAvailable /proc/meminfo | awk '{print $2}')
used=$(bc <<< "$total-$avail") used=$(bc <<< "$total-$avail")
@@ -171,7 +159,6 @@ stat(){
term(){ term(){
admin admin
fdebug "term"
sendmsg "\`$(whoami)@${HOSTNAME}:${PWD}$\` \`$args\` sendmsg "\`$(whoami)@${HOSTNAME}:${PWD}$\` \`$args\`
\`$(echo $args | bash - 2>&1)\`" \`$(echo $args | bash - 2>&1)\`"
} }