Oper who/whowas limit fix needed

By Cheiron on Sep 07, 2019

Having a problem editing the output of a whois and whowas script currently..

It is the whowas (.lastid) i am having issues with. with the .msg #ops .. it outputs fine.. But with a large whowas.. i dont want it to flood the channel..

I have tried to swap .msg #ops to .msg $nick but no pm opens to the user issuing the command!
for the moment i have commented out the command to remove it from the ops menu of commands

Looking for a fix please.. and a limit to just 10 results being outputted.

raw 311:*: {
  .msg #ops $2 $+ 's whois ID: $+($3,@,$4) and Real Name is: $6- | halt
}
raw 314:*: {
  ;.msg #ops $2 $+ 's whowas ID: $+($3,@,$4) and Real Name was: $6- | halt
  ;.msg $nick $2 $+ 's whowas ID: $+($3,@,$4) and Real Name was: $6- | halt
}
on *:text:*:#ops: {
  if ($nick isop $chan) && ($regex($1-,/(^|\s)(.idshow?w?s?\s\S+)/i)) {
    tokenize 32 $regml(2) | whois $2
  }
  if ($nick isop $chan) && ($regex($1-,/(^|\s)(.lastid?d?s?\s\S+)/i)) {
    tokenize 32 $regml(2) | whowas $2
  }
}

bot is mirc 7.55

Comments

Sign in to comment.
Degausser   -  9 days ago

Yeah I had trouble responding a couple days ago, but figured I'd make the fix publicly available. The issue was that $nick wasn't referencing what you expected. This was my solution:

Edited about an hour after original post with new link: https://pastebin.com/bAw6cA0j - This should go through all returned results.

Cheiron  -  9 days ago

Missed a few bits of code there.. but i fixed that bit.. however..
still errors.. the bot outputs everything to status still... but it does open the pm now.. but,... it only shows 1 result on the whowas! dont forget when you post a code to use square brackets with code and /code inside them.. [ code ] code here [ /code ] obviosly without the spaces in the square brackets :)

raw 311:*: {
  .msg #ops $2 $+ 's whois ID: $+($3,@,$4) and Real Name is: $6- | halt
}
raw 314:*: {
  ;.msg #ops $2 $+ 's whowas ID: $+($3,@,$4) and Real Name was: $6-
  sendToUser $numeric $2 $2 $+ 's whowas ID: $+($3,@,$4) and Real Name was: $6-
  haltdef
}

on *:text:*:#ops: {
  if ($nick isop $chan) && ($regex($1-,/(^|\s)(.idshow?w?s?\s\S+)/i)) {
    tokenize 32 $regml(2) | whois $2
  }
  if ($nick isop $chan) && ($regex($1-,/(^|\s)(.lastid?d?s?\s\S+)/i)) {
    addRawUser 314 $2 $nick
    tokenize 32 $regml(2) | whowas $2
  }
}

;/addRawUser <searchTerm/searchForUser>
alias -l addRawUser {
  var %search = $2, %user = $3, %table = $+(event_searchtable,$1)
  if (!$hget(%table)) .hmake %table 2
  if ($len($hget(%table,%search))) hadd %table %search $addtok($hget(%table,%search),%user,9)
  else hadd %table %search %user
}

;/sendToUser <searchTerm/searchForUser>
alias -l sendToUser {
  var %search = $2, %table = $+(event_searchtable,$1)
  if ($len($hget(%table,%search))) {
    var %users = $hget(%table,%search)
    while ($len(%users)) {
      .msg $gettok(%users,1,9) $3-
      %users = $deltok(%users,1,9)
    }
    hdel %table %search
  }
}
Degausser  -  9 days ago

I've used a link in my previous post to format the script output properly

Cheiron  -  9 days ago

That outputed some 30+ whowas's! not 10 heh.... it showed the whole lot. gone from 1 to all!

Degausser  -  8 days ago

Alright, edited the link once more, it should now limit to 10. I can't test because event 311 never gets called on the network I reside on, it always falls to 314. Hopefully you'll be able to sniff out any bugs that pop up, if indeed there are any.

Cheiron  -  8 days ago

Yeap thats working perfect to pm Degausser.. awesome work and many thanks. Just a curiousity... but is there a way to stop the scroll in the bot's status when it calls the whowas?

Degausser  -  8 days ago

Yeah but I can't reproduce the output, so here's what you should do.. Add this to your remotes:

raw *:*:{ echo -s $numeric $+ : $1- }

Then check all numbers that popup in the status window when someone triggers lastid. If the user exists, you will see 314, 369, and maybe something else? So that other number you see (not 406, this is user not found), take it and replace the number 9999 below with that number:

raw 9999:*: {
  if ($hasActiveSearch(314,$2)) haltdef
}

And maybe that does the trick? Otherwise I don't really know what you mean... I don't really see a reason why any form of auto-scrolling / output would be displayed.

Don't forget to remove the first piece of code from your script afterwards.

Cheiron  -  8 days ago

the raw is 312. nice catch and fix. i take my hat off to you. much appreciated

Sign in to comment

simo   -  10 days ago

not sure if this is what u meant but u can try it


on *:text:*:#ops: {
  if ($nick isop $chan) && ($regex($1-,/(^|\s)(.idshow?w?s?\s\S+)/i)) {
    set -u3 %whoisnicks $gettok($replace($gettok($2-,1-,46),$chr(32),$chr(44)),1,46)
    if ($numtok(%whoisnicks,44) <= 10) {
      tokenize 32 $regml(2) | whois $2
    } 
  }
  if ($nick isop $chan) && ($regex($1-,/(^|\s)(.lastid?d?s?\s\S+)/i)) {
    set -u3 %whowasnicks $gettok($replace($gettok($2-,1-,46),$chr(32),$chr(44)),1,46) 
    if ($numtok(%whowasnicks,44) <= 10) {
      tokenize 32 $regml(2) | whowas $2
    }
  }
}
Cheiron  -  10 days ago

Still got the primary issue of the bot sending to pm! I did try replacing that section on my bot and nought showing at all now... something is not quite right!

Sign in to comment

Degausser   -  14 days ago

If you remove the dot prefixing 'msg', then the pm window will open. Prefixing a command with a dot is a method of silencing a command. I think in this case, it's probably better to silence anyway.

Cheiron  -  13 days ago

already tried that and the bot only displays in it's status window!

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.