Fixed a bug in parsing input with calling the bot by name, also, added convert module that requires the units program.
This commit is contained in:
parent
8314bc2411
commit
1a3a715670
8
bot.sh
8
bot.sh
@ -83,7 +83,7 @@ do
|
||||
if [ -z "$(ls modules/ | grep -i -- "$command")" ] || [ -z "$command" ]; then
|
||||
continue
|
||||
fi
|
||||
./modules/${command% *}/${command% *}.sh "$who" "$from" "$will"
|
||||
./modules/${command% *}/${command% *}.sh "$who" "$from" $will
|
||||
else
|
||||
./triggers/keywords/keywords.sh "$who" "$from" "$result"
|
||||
fi
|
||||
@ -95,19 +95,19 @@ do
|
||||
else
|
||||
will="${result:1}"
|
||||
will="${will#* :}"
|
||||
from=$who
|
||||
from="$who"
|
||||
fi
|
||||
# Had to turn on globbing to remove all leading whitespace, then turn it off again afterwards.
|
||||
shopt -s extglob
|
||||
will="${will##*( )}"
|
||||
shopt -u extglob
|
||||
command="${will% *}"
|
||||
command="${will%% *}"
|
||||
will="${will#* }"
|
||||
if [ -z "$(ls modules/ | grep -i -- "$command")" ] || [ -z "$command" ]; then
|
||||
./modules/help/help.sh "$who" "$from"
|
||||
continue
|
||||
fi
|
||||
./modules/$command/$command.sh "$who" "$from" "$will"
|
||||
./modules/$command/$command.sh "$who" "$from" $will
|
||||
;;
|
||||
*)
|
||||
echo "$result" | tee -a "$log"
|
||||
|
12
modules/convert/convert.sh
Executable file
12
modules/convert/convert.sh
Executable file
@ -0,0 +1,12 @@
|
||||
[ -f functions.sh ] && source functions.sh
|
||||
|
||||
units="$(command -v units)"
|
||||
|
||||
shift
|
||||
chan="$1"
|
||||
shift
|
||||
if [ -z "$units" ]; then
|
||||
msg "$chan" "I do not have access to units."
|
||||
else
|
||||
msg "$chan" "$($units -v $@ | head -n1)"
|
||||
fi
|
Loading…
Reference in New Issue
Block a user