I have a neat script that I stumbled here in the forums and it's working but I'd like to add common channels, if possible.
Script to return which common channel it last saw the user.
For example, I did !seen <nick> in channel #1, and the script would return which last common channel it last saw the nick (in case the user did not join #channel 1, but happened to actually join channel#2 and parted/quitted there, kinda thing, if that makes sense, heh).

Can someone help me with this?

Code
 seen script--

alias seenstart {
  hfree -w seen
  hmake seen 500
  if (!$isfile(Seen.db)) write Seen.db
  hload -b seen Seen.db
}

alias -l seentime return $asctime($gmt,yyyy-mm-dd HH:nn:ss) UTC.

alias -l seenshort if ($len($1) > $2) return $left($1,$2) $+ ... | else return $1

on *:start:seenstart

on *:exit:hsave -b seen Seen.db

on *:join:#:hadd seen $nick $gmt $nick joining # channel at $seentime

on *:part:#:hadd seen $nick $gmt $nick leaving # channel $iif($1-,with $qt($seenshort($strip($1-),300)) message,without a message) at $seentime

on *:quit:hadd seen $nick $gmt $nick quitting $iif($1-,with $qt($seenshort($strip($1-),300)) message,without a message) at $seentime

on *:kick:#: {
  hadd seen $knick $gmt $knick getting kicked from # channel by $nick $iif($1-,with $qt($seenshort($strip($1-),300)) message,without a message) at $seentime
  hadd seen $nick $gmt $nick kicking $knick from # channel $iif($1-,with $qt($seenshort($strip($1-),300)) message,without a message) at $seentime
}

on *:nick: {
  hadd seen $nick $gmt $nick changing their name to $newnick at $seentime
  hadd seen $newnick $gmt $nick changing their name to $newnick at $seentime
}

on *:topic:#:hadd seen $nick $gmt $nick changing the topic of # channel to $qt($seenshort($strip($1-),300)) at $seentime

on *:notice:*:#:hadd seen $nick $gmt $nick saying $qt($seenshort($strip($1-),300)) on # at $seentime

ctcp *:*:#:hadd seen $nick $gmt $nick sending $qt($seenshort($strip($1-),300)) CTCP message on # at $seentime

on *:action:*:#:hadd seen $nick $gmt $nick saying $qt($seenshort($strip($1-),300)) on # at $seentime

on *:text:*:#: {
  hadd seen $nick $gmt $nick saying $qt($seenshort($strip($1-),300)) on # at $seentime
  if ($istok(! . @ $ �,$left($1,1),32)) && ($istok(seen s,$mid($1,2-),32)) {
    var %m = .msg #
    if (!$2) %m Error: invalid parameters. Usage: $upper($1) <NAME>
    elseif ($2 == $me) %m I believe I'm right here, although I might be wrong. Maybe I'm just the product of your imagination.
    elseif ($2 == $nick) %m $replacex($gettok(<nick>? Never heard. <44> @.@ |I heard <nick> is somewhere in the mirror<44> go and take look.|<nick probably is on a date!|<nick> is behind you... awooo.,$rand(1,10),124),<nick>,$nick,<44>,$chr(44))
    elseif ($hget(seen,$2)) { tokenize 32 $v1 | %m I last saw $2- $b($duration($calc($gmt -$1)) ago) }
    elseif ($hget(seen,$hfind(seen,$2,1,w).item)) {
      var %n = $2
      tokenize 32 $v1
      %m I last saw $2- $b($duration($calc($gmt -$1)) ago)
      if ($hfind(seen,%n,0,w) > 1) %m There are also $bytes($calc($v1 -1),b) other(s) whose name matches to $qt(%n) $+ : $seenlistnames(%n)
    }
    else %m I don't think I know who $2 is or seen lately. 
  }
}

alias -l seenlistnames {
  var %x = 2,%n
  while ($hfind(seen,$1,%x,w)) {
    var %n = %n $v1
    if (%x >= 10) return $replace(%n,$chr(32),$chr(44) $+ $chr(32)) $+ ...
    inc %x
  }
  return $replace(%n,$chr(32),$chr(44) $+ $chr(32))
}




JilValentine | (Read error: EOF from client) | https://jilvalentine.de