Can someone fixed or rewrite this code for me please? he does not work.

Here is my code:

Код:
on *:JOIN:#:{
  if ($istok(#test1 #test2 #test3,$chan,32)) {
    if ($nick == $me) { halt }
    if ($nick isop $chan) { return }
    var %host = $ial($nick).host
    var %file = autoopip.txt
    if ($read(%file,w,$+(*,%host,*))) {
      var %str $read(%file,$readn)
      if ($+(*,%host,*) iswm $gettok(%str,1,59)) {
      var %chanop $gettok(%str,2,59)
        mode %chanop +o $nick | .notice @ $+ $chan $chan - $me ( $+ $me $+ ) opped: $nick
      }
    }
  }
}

In the file "autoopip.txt" there are identical IPs/Hosts, but different #room names as follows:

188.26.59.16;#test1
161.184.143.251;#test2
id-586239.lymington.irccloud.com;#test1
id-586239.lymington.irccloud.com;#test2
id-586239.lymington.irccloud.com;#test3
id-455146.ilkley.irccloud.com;#test3
id-455146.ilkley.irccloud.com;#test2

If this Ip/host join #test1 #test2 #test3 then My Bot will Op this nick use this Ip/host.