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:
parent
8c1edc25bc
commit
b7a542fadd
4
bot.cfg
4
bot.cfg
@ -1,7 +1,5 @@
|
|||||||
#enter channels here in quotes before the )
|
#enter channels here in quotes before the )
|
||||||
channel=(
|
channel="a11y"
|
||||||
"a11y"
|
|
||||||
)
|
|
||||||
# The date format for log entries. man date for details.
|
# The date format for log entries. man date for details.
|
||||||
dateFormat='%B %d, %I:%m%P'
|
dateFormat='%B %d, %I:%m%P'
|
||||||
# Greet people who enter the channel? (true/false)
|
# Greet people who enter the channel? (true/false)
|
||||||
|
10
bot.sh
10
bot.sh
@ -20,10 +20,7 @@ trap close_bot EXIT $?
|
|||||||
echo "Session started $(date "+%I:%M%p%n %A, %B %d, %Y")" | tee "$log"
|
echo "Session started $(date "+%I:%M%p%n %A, %B %d, %Y")" | tee "$log"
|
||||||
echo "NICK $nick" | tee "$input"
|
echo "NICK $nick" | tee "$input"
|
||||||
echo "USER $user" | tee -a "$input"
|
echo "USER $user" | tee -a "$input"
|
||||||
for c in ${channel[@]} ; do
|
echo "JOIN #$channel" | tee -a "$input"
|
||||||
echo "JOIN #$c" | tee -a "$input"
|
|
||||||
sleep 0.5
|
|
||||||
done
|
|
||||||
|
|
||||||
tail -f "$input" | telnet "$server" "$port" | while read result
|
tail -f "$input" | telnet "$server" "$port" | while read result
|
||||||
do
|
do
|
||||||
@ -43,7 +40,7 @@ do
|
|||||||
# Run on kick
|
# Run on kick
|
||||||
:*!*@*" KICK "*" $nick :"*)
|
:*!*@*" KICK "*" $nick :"*)
|
||||||
if [ "$autoRejoinChannel" = "true" ]; then
|
if [ "$autoRejoinChannel" = "true" ]; then
|
||||||
echo "JOIN #$c" | tee -a "$input"
|
echo "JOIN #$channel" | tee -a "$input"
|
||||||
fi
|
fi
|
||||||
if [ "$curseKicker" = "true" ]; then
|
if [ "$curseKicker" = "true" ]; then
|
||||||
kickerName="${result%!*}"
|
kickerName="${result%!*}"
|
||||||
@ -90,7 +87,8 @@ set +f
|
|||||||
who="${result%%!*}"
|
who="${result%%!*}"
|
||||||
who="${who:1}"
|
who="${who:1}"
|
||||||
from="${result#*#}"
|
from="${result#*#}"
|
||||||
from="#${from%% *}"
|
from="${from%% *}"
|
||||||
|
from="#${from:-$channel}"
|
||||||
# Trigger stuff happens here.
|
# Trigger stuff happens here.
|
||||||
# Call link trigger if msg contains a link:
|
# Call link trigger if msg contains a link:
|
||||||
if [[ "$result" =~ .*http://|https://|www\..* ]]; then
|
if [[ "$result" =~ .*http://|https://|www\..* ]]; then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user