Some code cleanup, changed channel from an array to a single variable because no matter what I do the bot only connects to one channel. Attempted to get the bot to recognize private messages, but still no luck.

This commit is contained in:
Storm Dragon 2017-05-07 17:09:44 -04:00
parent 8c1edc25bc
commit b7a542fadd
2 changed files with 5 additions and 9 deletions

View File

@ -1,7 +1,5 @@
#enter channels here in quotes before the )
channel=(
"a11y"
)
channel="a11y"
# The date format for log entries. man date for details.
dateFormat='%B %d, %I:%m%P'
# Greet people who enter the channel? (true/false)

10
bot.sh
View File

@ -20,10 +20,7 @@ trap close_bot EXIT $?
echo "Session started $(date "+%I:%M%p%n %A, %B %d, %Y")" | tee "$log"
echo "NICK $nick" | tee "$input"
echo "USER $user" | tee -a "$input"
for c in ${channel[@]} ; do
echo "JOIN #$c" | tee -a "$input"
sleep 0.5
done
echo "JOIN #$channel" | tee -a "$input"
tail -f "$input" | telnet "$server" "$port" | while read result
do
@ -43,7 +40,7 @@ do
# Run on kick
:*!*@*" KICK "*" $nick :"*)
if [ "$autoRejoinChannel" = "true" ]; then
echo "JOIN #$c" | tee -a "$input"
echo "JOIN #$channel" | tee -a "$input"
fi
if [ "$curseKicker" = "true" ]; then
kickerName="${result%!*}"
@ -90,7 +87,8 @@ set +f
who="${result%%!*}"
who="${who:1}"
from="${result#*#}"
from="#${from%% *}"
from="${from%% *}"
from="#${from:-$channel}"
# Trigger stuff happens here.
# Call link trigger if msg contains a link:
if [[ "$result" =~ .*http://|https://|www\..* ]]; then