Cleaned up the code a bit, the formatting at least, there's plenty more to do.
This commit is contained in:
8
bot.sh
8
bot.sh
@@ -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
|
||||
|
Reference in New Issue
Block a user