Remote Who Is adder

By GrimReaper on Sep 20, 2009

This snippet is a modded version of Vox91's Trigger script. Located at http://www.hawkee.com/snippet/4452/

It does work as i have tested it. and it's all good.

you have to add yourself as /auser 250 on your bot's side. or higher.

Trigger Syntax is:

.addwho
.delwho (a ? will be added within the script. so you'll need to do .delwho ?)
.listwho (Will show all the people added within the script.
.listwho -l (Will show all people within the script with the information added to the who is as well.)
.listwho -s ? (Will show the desired nick and their information)

I had a little help from FordLawnmower on the saving of the hsh files. as it wouldn't save them on Exit. so Thanks Ford :>

alias aversion { return 1.0 }
alias cmdchar { return . }
alias addon.status { return on }

; ---------------------------------------------------------------------------------------------------------------
; on :XXX: events
; ---------------------------------------------------------------------------------------------------------------

on *:LOAD: {
  set %whoemailaddy $?="Which email should they contact in case of script failure?"
  hmake whois.addon 10000
  if ($exists(whois.hsh)) { hload whois.addon whois.hsh }
}
On *:Close: { 
  if ($hget(whois.addon)) { 
    hsave -s whois.addon whois.hsh 
  } 
}
on *:START: {
  hmake whois.addon 10000
  if ($exists(whois.hsh)) { hload whois.addon whois.hsh }
}
on *:UNLOAD: {
  if ($exists(whois.hsh)) {
    $iif($input(Do you want to remove the storage file?,yn),.remove -b whois.hsh)
    if ($hget(whois.addon)) {
      hfree whois.addon
      var %unload $input(Script has been unloaded.,o)
    }
  }
}

; ---------------------------------------------------------------------------------------------------------------
; The Trigger script
; ---------------------------------------------------------------------------------------------------------------

on 250:TEXT:*:#: {
  if ($addon.status != on) && ($addon.status != off) { .msg $chan invalid configurations. | halt }
  elseif ($addon.status == off) { halt }
  elseif ($1 == Who) {
    if ($2 == Is) {
      if ($hget(whois.addon, $3) != $null) { 
        msg $chan $replace($hget(whois.addon, $3), <nick>, $nick, <chan>, $chan, <host>, $address($nick,2), <b>, , <u>, )
        halt
      }
    }
  }
  elseif ($1 == $cmdchar $+ addwho) { 
    if (!$3) { .notice $nick More parameters needed. | halt }
    elseif ($2 == $cmdchar $+ addwho) || ($2 == $cmdchar $+ delwho) || ($2 == $cmdchar $+ ListWho) { .notice $nick Primary triggers cant be set. | halt }
    elseif ($2 == $cmdchar $+ info) { .notice $nick Primary triggers cant be set. | halt }
    elseif ($hget(whois.addon, $2) != $null) { .notice $nick Trigger already taken. | halt }
    hadd -m whois.addon $2 $+ ? $3-
    hsave whois.addon whois.hsh
    msg $chan A new Trigger was added by $nick (Trigger: Who Is $2 $+ ?, Text: $3-)
  }
  elseif ($1 == $cmdchar $+ delwho) {
    if (!$2) { .notice $nick More parameters needed. | halt }
    elseif (!$hget(whois.addon, $2)) { .notice $nick This trigger doesnt exist. | halt }
    hdel whois.addon $2
    hsave whois.addon whois.hsh
    msg $chan The trigger Who Is $2 has been removed.
  }
  elseif ($1 == $cmdchar $+ ListWho) {
    if (!$2) { 
      var %totalwho $hget(whois.addon, 0).item, %countwho = 0, %listswho
      while (%countwho < %totalwho) {
        inc %countwho
        %listswho = $addtok(%listswho,Who Is $hget(whois.addon, %countwho).item $chr(45) , 32)
      }
      .notice $nick $iif(%listswho == $null, No triggers found, $v1)
    }
    if ($2 == -l) {
      var %totalwho $hget(whois.addon, 0).item, %countwho = 0, %listswho
      while (%countwho < %totalwho) {
        inc %countwho
        .notice $nick Who Is $hget(whois.addon, %countwho).item $+ : $hget(whois.addon, $hget(whois.addon, %countwho).item)
      }
      .notice $nick $iif(%totalwho == 0, No triggers found, End of triggerlist.)
    }
    if ($2 == -s) {
      if (!$3) { .notice $nick more parameters needed. | halt }
      var %totalwho $hget(whois.addon, 0).item, %countwho = 0, %listswho
      while (%countwho < %totalwho) {
        inc %countwho
        if (* $+ $3 $+ * iswm $hget(whois.addon, %countwho).item) {
          .notice $nick Who Is $hget(whois.addon, %countwho).item $+ : $hget(whois.addon, $hget(whois.addon, %countwho).item)
        }
      }
      .notice $nick $iif(%totalwho == 0, No triggers found, End of triggerlist.)
    }
  }
  if ($1 == $cmdchar $+ info) {  .msg $chan 0,1-=[Who Is Addon :: Version: $aversion © by GrimReaper :: irc.SPUNet.org / #hell $&
    For any errors please report them to: %whoemailaddy $+ ]=- }
  else { $null }
}

Comments

Sign in to comment.
UncleJohn   -  Mar 14, 2010

Here is a bypass for the scripts auser requirement completly

On :TEXT::#: {
if ($addon.status != on) && ($addon.status != off) { .msg $chan invalid configurations. | halt }
elseif ($addon.status == off) { halt }
elseif ($1 == What) {
if ($2 == Is) {
if ($hget(whatis.addon, $3) != $null) {
.msg $chan $replace($hget(whatis.addon, $3), , $nick, , $chan, , $address($nick,2), , , , )
halt
}
}
}
elseif ($addon.status != on) && ($addon.status != off) { .msg $chan invalid configurations. | halt }
elseif ($addon.status == off) { halt }
elseif ($1 == Who) {
if ($2 == Is) {
if ($hget(whois.addon, $3) != $null) {
msg $chan $replace($hget(whois.addon, $3), , $nick, , $chan, , $address($nick,2), , , , )
halt
}
}
}

}

 Respond  
GrimReaper   -  Sep 21, 2009

@TheProdigY
it's ok. thanks for the feedback. I do get what you mean. and the on 250:TEXT can be changed to whatever people want it to be. i just have it that way as then i can pick and choose who i have being able to use the script. and other's may think otherwise.

You are welcome to remake the script. as i said. it's there for people. and i see no harm in other's modding it.

and i know it's the basic format of Vox91's snippet. as i said in the intro. It can do with a little more modifying and i will get round to that when i am not busy. :>

Also thank's for the rating :>

 Respond  
TheProdigY   -  Sep 20, 2009

I don't see the purpose of this script unless you made it to be a personal WhoIs ?

I figured it would be more of a Trigger script too since you said this is a modified version of Vox91's Trigger Script.

But like I said, if this script is just to add information to who is the specified user then keep it like that. (Pointless to me)

Add a regular trigger to your script like Vox91 did. For example:

: .addwho JohnDoe 21/m from Honolulu, Hawaii <$address> : A new Trigger was added by user (Trigger: Who Is JohnDoe?, Text: 21/m from Honolulu, Hawaii <$address>) : Who is JohnDoe? : 21/m from Honolulu, Hawaii *the return address* AND the separate trigger script...... : !addtrig trigthis This trig will trigger this message! : A new Trigger was added by user (Trigger: !trigthis Text: This trig will trigger this message!) : !trigthis : This trig will trigger this message! That would be a better script combined so users have both options and the script won't be as pointless to some. I'm currently working on modifying it myself to use both methods in one script. Another thing..... people who have access levels 250 or greater can use that but people below that level cannot. So why not add the 2nd part to it for fun? Every server I've been to I've seen people enjoying making trigger commands or have wanted one in their channel. It's just for fun. You can also set the !addtrig to a specific level so you don't get a bunch of idiots overwriting a bunch of triggers. Which would be.... on 4:TEXT:*:#: { or on 5:TEXT:*:#: ( 4 = Hop 5 = Op Anybody on that level or higher can make fun trigger commands. That's it for now. I like the script but see if you can add to it. If I've misjudged something or read something wrong, making this whole comment useless, then I apologize in advance. Rated: 8/10
 Respond  
GrimReaper   -  Sep 20, 2009

Well... i need to test them all out before releasing them.. it took time.. but I got there in the end.. with help of some friends. :>

 Respond  
DragonHeart   -  Sep 20, 2009

awesome to see you finally released this awesome script... now to add it :)

 Respond  
dotcomboy17   -  Sep 20, 2009

Nice Script, Im going to be adding it to try it out! :D

 Respond  
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.