on 1:connect: {
var %lines $lines(channels.txt)
while (%lines) {
var %channel $read(channels.txt,%lines)
j %channel
dec %lines
}
}
on *:text:!ajoin & &:#: {
var %action $1
var %channel $lower($2)
if (%action == add) {
if (!$read(channels.txt,ns,%channel)) {
write channels.txt %channel
msg # Added %channel to auto join list
}
else msg # %channel is already on the list
}
elseif (%action == del) {
if ($read(channels.txt,ns,%channel)) {
write -dl $+ $readn channels.txt
msg # Deleted %channel from auto join list
}
else msg # %channel wasn't on the list.
}
}