Cleaned up the code a bit, the formatting at least, there's plenty more to do.

This commit is contained in:
Storm Dragon
2020-08-13 20:46:09 -04:00
parent 273e24a63a
commit 5984a2dbb2

8
bot.sh
View File

@@ -8,8 +8,7 @@ fi
[ -f bot.cfg ] && source bot.cfg
input=".botinput"
close_bot()
{
close_bot() {
echo -en "QUIT :$quitMessage\r\n" >> "$input"
rm "$input"
exit 0
@@ -22,8 +21,7 @@ echo "NICK $nick" > "$input"
echo "USER $user" >> "$input"
echo "JOIN #$channel" >> "$input"
tail -f "$input" | telnet "$server" "$port" | while read result
do
tail -f "$input" | telnet "$server" "$port" | while read -r result ; do
# log the session
echo "$(date "+[$dateFormat]") $result" >> "$log"
# do things when you see output
@@ -118,7 +116,7 @@ set -f
fi
# "#" would mean it's a channel
if [ "$(echo "$from" | grep '#')" ]; then
test "$(echo "$result" | grep ":$nick:")" || continue
[[ "$(echo "$result" | grep ":$nick:")" ]] || continue
will="${result#*#*:}"
will="${will#*:}"
else