Nickserv / Database !seen Dalnet

By Ryano69 on May 08, 2016

Nickserv !seen and Database, Redundant. works for Dalnet
Best used for private channels, or if you don't want to share !seen data between channels.

  1. Change set %nickcheck.target #chan to your specified channel (line 106)
  2. Change (line 82 and 79) #chan to your specified channel

Examples.
"< w*> !seen lalalalalala"
" I Have Never Seen This Nick and it is Not Registered with NickServ."

"<w*> !seen fckd"
"< seenbot333> User is Currently Online but Not in This Channel"
" I Havent Seen this nick , Last Login From NickServ ( 1day 18hrs 55mins 14secs ) ago"

"<w> !seen kakaka"
" I last saw kakaka (~looser@24.244.
) 5secs ago, parting from #sandwich, stating:"
If you want help come to #sandwich on irc.dal.net:6667 my nick is wiretap

##### Instructions ########
##### Change(line 110) set %nickcheck.target #chan to your specified channel (line 106) #######
#####Change (line 5 and 10) #chan to your specified channel ########
on *:NOTICE:*currently on IRC*:?:{
  elseif ($8 != #sandwich) {
    .msg #sandwich User is Currently Online but Not in This Channel
  }
} 
on *:NOTICE:*is not registered*:?:{
  .msg #sandwich $3 is Not Registered with NickServ.
}
on *:START:{
  if (!$hget(LastSeen)) { .hmake LastSeen 100 }
  if ($exists(LastSeen.hsh)) { .hload LastSeen LastSeen.hsh }
}
on *:TEXT:!seen*:#:{
  msg nickserv@services.dal.net info $2
  if (!$2) { halt }
  else {
    var %seen.entry = $hget(LastSeen,$2), %seen.action = $null, %seen.name = $2
    if ($nick == $2) { msg $chan Hey, Narcisso, stop looking for yourself. | halt }
    elseif ($2 == $me) { describe $chan waves to $nick $+ . | halt }
    elseif ($2 ison $chan) { msg $chan $2 is currently in the channel! | halt }
    elseif (!%seen.entry) {
      var %seen.num = $hfind(LastSeen,* $+ $2 $+ *,0,w)
      if (%seen.num == 0) {
        msg $chan No Data
        halt
      }

      else {
        var %seen.i = 1
        while (%seen.i <= $hfind(LastSeen,* $+ $2 $+ *,0,w)) {
          write LastSeen.tmp $hfind(LastSeen,* $+ $2 $+ *,%seen.i,w) $hget(LastSeen,$hfind(LastSeen,* $+ $2 $+ *,%seen.i,w))
          inc %seen.i
        }
        filter -ffteu 3 32 LastSeen.tmp LastSeen2.tmp *
        msg $chan I found %seen.num results for your LastSeen query. $iif(%seen.num > 5,Here are the top 5,Here are the results) $+ , starting with the newest result: $gettok($read(LastSeen2.tmp,1),1,32) $gettok($read(LastSeen2.tmp,2),1,32) $gettok($read(LastSeen2.tmp,3),1,32) $gettok($read(LastSeen2.tmp,4),1,32) $gettok($read(LastSeen2.tmp,5),1,32)
        %seen.name = $gettok($read(LastSeen2.tmp,1),1,32)
        .remove LastSeen.tmp
        .remove LastSeen2.tmp
      }
    }
    %seen.entry = $hget(LastSeen,%seen.name)
    %seen.action = $replace($gettok(%seen.entry,3,32),JOIN,joining $gettok(%seen.entry,4,32) $+ .)
    %seen.action = $iif(%seen.action == $gettok(%seen.entry,3,32),$replace($gettok(%seen.entry,3,32),TEXT,talking in $gettok(%seen.entry,4,32) $+ . They were saying: $gettok(%seen.entry,5-,32)),%seen.action)
    %seen.action = $iif(%seen.action == $gettok(%seen.entry,3,32),$replace($gettok(%seen.entry,3,32),ACT,acting in $gettok(%seen.entry,4,32) $+ . They were saying: * $2 $gettok(%seen.entry,5-,32)),%seen.action)
    %seen.action = $iif(%seen.action == $gettok(%seen.entry,3,32),$replace($gettok(%seen.entry,3,32),PART,parting from $gettok(%seen.entry,4,32) $+ $chr(44) stating: $gettok(%seen.entry,5-,32)),%seen.action)
    %seen.action = $iif(%seen.action == $gettok(%seen.entry,3,32),$replace($gettok(%seen.entry,3,32),QUIT,quitting from IRC $+ $chr(44) saying: $gettok(%seen.entry,4-,32)),%seen.action)
    %seen.action = $iif(%seen.action == $gettok(%seen.entry,3,32),$replace($gettok(%seen.entry,3,32),KICKED,being kicked from $gettok(%seen.entry,5,32) by $gettok(%seen.entry,4,32) $+ $chr(44) who stated: $gettok(%seen.entry,6-,32)),%seen.action)
    %seen.action = $iif(%seen.action == $gettok(%seen.entry,3,32),$replace($gettok(%seen.entry,3,32),KICK,kicking $gettok(%seen.entry,4,32) from $gettok(%seen.entry,5,32) $+ $chr(44) stating: $gettok(%seen.entry,6-,32)),%seen.action)
    %seen.action = $iif(%seen.action == $gettok(%seen.entry,3,32),$replace($gettok(%seen.entry,3,32),FROMNICK,changing nicknames from their old nick $+ $chr(44) which was $gettok(%seen.entry,4,32) $+ .),%seen.action)
    %seen.action = $iif(%seen.action == $gettok(%seen.entry,3,32),$replace($gettok(%seen.entry,3,32),CHNICK,changing their nickname to $gettok(%seen.entry,4,32) $+ .),%seen.action)
    %seen.entry = I last saw  $+ %seen.name $+  ( $+ $gettok(%seen.entry,1,32) $+ ) $duration($calc($ctime - $gettok(%seen.entry,2,32))) ago, %seen.action
    msg $chan %seen.entry
  }
}
on *:JOIN:#:{
  .hadd -m LastSeen $nick $address $ctime JOIN $chan
}
on *:TEXT:*:#:{
  .hadd -m LastSeen $nick $address $ctime TEXT $chan $1-
}
on *:ACTION:*:#:{
  .hadd -m LastSeen $nick $address $ctime ACT $chan $1-
}
on *:PART:#:{
  .hadd -m LastSeen $nick $address $ctime PART $chan $1-
}
on *:QUIT:{
  .hadd -m LastSeen $nick $address $ctime QUIT $1-
}
on *:KICK:#:{
  .hadd -m LastSeen $nick $address $ctime KICK $knick $chan $1-
  .hadd -m LastSeen $knick $remove($address($knick,5),$knick $+ !) $ctime KICKED $nick $chan $1-
}
on *:NICK:{
  .hadd -m LastSeen $newnick $address $ctime FROMNICK $nick
  .hadd -m LastSeen $nick $address $ctime CHNICK $newnick
}
on *:DISCONNECT:{
  .hsave -o LastSeen LastSeen.hsh
}
on *:EXIT:{
  .hsave -o LastSeen LastSeen.hsh
}
else { set -u5 %seen $chan | whois $1 }

on *:NOTICE:Info for*:?:{
  if ($1 == $null) { return }
  if (%nickflood) {
    var %diff $calc($ctime - %nickflood)
    if (%diff < 10) {
      msg $chan Too soon $nick
      return
    }
  }
  %nickflood = $ctime
  if (%nickcheck.active) {
    var %diff $calc(%nickcheck.active - $ctime)
    if (%diff < 600) {
      msg $chan Sorry, already checking a nick
      return
    }
  }
  else {
    set %nickcheck.active $ctime
    set %nickcheck.nick $8
    set %nickcheck.found 0
    set %nickcheck.target #sandwich
    nickserv info %nickcheck.nick
  }
}
on *:notice:Info for *:?:{
  if ($3 == %nickcheck.nick) {
    set %nickcheck.found 1
  }
}
on *:notice:Last seen time*:?:{
  if ($nick != nickserv) { return }
  if (%nickcheck.target) {
    var %timevalue $5-
    var %duration $duration($convertzone(%timevalue))
    if (%nickcheck.target) {
      set %nickcheck.lastseen %duration
      ; msg %nickcheck.target Found string: %duration
    }

  }
}
on *:notice:Time registered*:?:{
  if ($nick != nickserv) {
    return
  }
  else if (%nickcheck.target) {
    var %timevalue $4-
    var %duration $duration($convertzone(%timevalue))
    msg %nickcheck.target  Last Login From NickServ ( %nickcheck.lastseen ) ago 
    unset %nickcheck.*
  }
}
alias convertzone {
  var %timestring $1-
  ;02-May-2016 09:41:50 GMT
  %timestring = $gettok(%timestring, 2-3, 32)
  var %day $gettok(%timestring, 1, 45)
  var %month $gettok(%timestring, 2, 45)
  var %year $gettok(%timestring, 3, 45)
  var %hms $gettok(%timestring, 2, 32)
  var %ts $ctime($gmt(%month %day %year %hms))
  return $calc($gmt - %ts)
}

Write here..

Comments

Sign in to comment.
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.