| View previous topic :: View next topic |
| Author |
Message |
zammer Voice
Joined: 14 Feb 2012 Posts: 2
|
Posted: Tue Feb 14, 2012 11:37 am Post subject: Freenode and WHOIS output |
|
|
Hey,
In irssi I have something like this (/whois zammer):
| Quote: | 16:14:11 [freenode] -!- zammer [zammer@somewhere.com]
12:14:11 [freenode] -!- ircname : zammer
12:14:11 [freenode] -!- channels : #chan1 #chan2
12:14:11 [freenode] -!- server : leguin.freenode.net [Ume?, SE, EU]
12:14:11 [freenode] -!- hostname : somewhere.com 72.57.251.23
12:14:11 [freenode] -!- idle : 0 days 0 hours 0 mins 4 secs [signon: Tue Feb 11 15:34:09 2012]
12:14:11 [freenode] -!- account : zammer
12:14:11 [freenode] -!- End of WHOIS
|
Could someone tell me please how can read into script:
16:14:11 [freenode] -!- account : zammer
I want to check account name and do some things if it match.
I have no idea how to do this with Freenode and the custom IRCd.
Any hint?
Thanks!
Best regards. |
|
| Back to top |
|
 |
Johannes13 Halfop
Joined: 10 Oct 2010 Posts: 46
|
Posted: Tue Feb 14, 2012 11:48 am Post subject: |
|
|
bind raw 330
:holmes.freenode.net 330 Johannes13 Johannes13 Johannes13 :is logged in as
ok, 1st nick is your nick (botnick)
2nd nick is the nick of the whois target
3rd nick is the accountname. |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Tue Feb 14, 2012 1:51 pm Post subject: Re: Freenode and WHOIS output |
|
|
| zammer wrote: |
In irssi I have something like this (/whois zammer):
....
12:14:11 [freenode] -!- account : zammer
...
|
Something to be aware of:
The way that line looks when you see it in irssi, is different from the way it looks when it appears in bot.
This is what it looks like to bot:
| Code: |
<botnick> [12:36:23] [@] barjavel.freenode.net 330 botnick jack3 jack3 :is logged in as
|
| Quote: |
Could someone tell me please how can read into script:
16:14:11 [freenode] -!- account : zammer
I want to check account name and do some things if it match.
I have no idea how to do this with Freenode and the custom IRCd.
...
|
Here is some stuff to play with. I hope it illustrates what is going on, and how to do it. You can uncomment lines as you wish, to see.
The way it is below, it sets a variable, and then sends you a line of text.
I assume that once you get the value into the variable, then that is what you wanted here... from there, you can do your own matching, etc.
| Code: |
# Feb 14, 2012
# experimenting with obtaining info from a /whois on freenode
# http://forum.egghelp.org/viewtopic.php?t=18839
# set your nick here. Bot will be sending a query (pm) to it
set mynick "zammer"
# reference:
# http://www.eggheads.org/support/egghtml/1.6.21/tcl-commands.html#binda
# and scroll down to bind raw
bind raw - 330 fn_whois
proc fn_whois {from key text} {
global mynick
#putserv "privmsg $mynick :from is $from"
#putserv "privmsg $mynick :key is $key"
#putserv "privmsg $mynick :text is $text"
#putserv "privmsg $mynick :first element is [lindex [split $text] 0]"
#putserv "privmsg $mynick :second element is [lindex [split $text] 1]"
#putserv "privmsg $mynick :third element is [lindex [split $text] 2]"
#putserv "privmsg $mynick :the rest is [lrange [split $text] 3 end]"
set accountname [lindex [split $text] 2]
putserv "privmsg $mynick :account name is: $accountname "
}
|
With a quick test, on Freenode, the above worked for me.
I hope it helps to answer your question. |
|
| Back to top |
|
 |
zammer Voice
Joined: 14 Feb 2012 Posts: 2
|
Posted: Wed Feb 15, 2012 2:59 pm Post subject: |
|
|
Hey,
Thanks for the hint.
I was looking at 330 output but I didn't know that the 3rd position is acc name.
Thanks
Best Regards |
|
| Back to top |
|
 |
|