egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Doing a whois to print out to a file

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
fayettemat
Voice


Joined: 09 Jan 2007
Posts: 27

PostPosted: Tue Feb 27, 2007 1:33 pm    Post subject: Doing a whois to print out to a file Reply with quote

ok here's the break down: I have an Eggdrop that I use for a protection bot and convince bot, it is Opered so I am not worried about it flooding but I cannot get the dumb bot to send the text I want to a file
Code:

 bind JOIN - * whois:nick
proc whois:nick { nick  uhost hand chan arguments }
   {
   set target == "$nick"
   putquick "WHOIS $target $target" -next
   bind RAW - 401 whois:nosuch
   bind RAW - 311 whois:info
   }
proc whois:nosuch { from keyword arguments }
   {
   putquick "There is so such nick name!"
   #unbind the raw#
   unbind RAW - 401 whois:nosuch
   }
proc whois:info { from keyword arguments }
   {
      set chan $chan
      set nick $nick
      set ident [lindex [split $arguments] 2]
      set host [lindex [spllit $arguments] 3]
      set realname [string range [join [lrange $arguements 5 end]] 1 end]
      #unbind The Raw#
      unbind RAW - 311 whois:info
      #saving to a file#
      set line_to_add "$nick\!$ident\@$host * $realname"
      set fname "testfile.txt"
      set fp [open $fname "a"]
      puts $fp $line_to_add
      close $fp
      #end saving to a file#
   }
#thanks to egghelp.org for the writting to file learning and MeTroiD for his #whois script I used both in an attempt to make this script!#
putlog "Whois on join ver 1.0b1"

as you can see what I am trying to do is to have it automatic in saving the users host upon joining, the reason I use this is because when I get complaints about spam from certian nicks I want to be able to have their full host and /whois <nick> only lasts for about 24 hrs
ps: it wont load lately
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Tue Feb 27, 2007 2:24 pm    Post subject: Reply with quote

What's the problem you're facing?
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
et109
Voice


Joined: 25 Feb 2007
Posts: 7
Location: Pennsylavnia

PostPosted: Tue Feb 27, 2007 2:33 pm    Post subject: whois info Reply with quote

if the code you are using is a match to this code, you have a typo in proc whois:info

Code:

      set host [lindex [spllit $arguments] 3]


should be
Code:

      set host [lindex [split $arguments] 3]
Back to top
View user's profile Send private message
fayettemat
Voice


Joined: 09 Jan 2007
Posts: 27

PostPosted: Tue Feb 27, 2007 3:09 pm    Post subject: Reply with quote

ok I'll try that Et and Sir_Fz the problem is that its not writing to a file and now it says that my code is invalid and I looked at that and I'm going to try again will edit post with results: wish me luck!
Back to top
View user's profile Send private message
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Tue Feb 27, 2007 4:51 pm    Post subject: Reply with quote

You might want to also catch your unbinds, otherwise the bot could crash if it tries to unbind something that's not already bound:

catch {unbind RAW - 401 whois:nosuch}
Back to top
View user's profile Send private message
fayettemat
Voice


Joined: 09 Jan 2007
Posts: 27

PostPosted: Tue Feb 27, 2007 6:02 pm    Post subject: Reply with quote

rosc2112 wrote:
You might want to also catch your unbinds, otherwise the bot could crash if it tries to unbind something that's not already bound:

catch {unbind RAW - 401 whois:nosuch}

so I would just catch {unbind RAW - 401 whois:nosuch} at the end of the file?
Back to top
View user's profile Send private message
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Tue Feb 27, 2007 9:30 pm    Post subject: Reply with quote

Not at the end. In the same place as the original unbind, just enclose it with catch {} so it doesn't crash the bot.

http://www.tcl.tk/man/tcl8.4/TclCmd/catch.htm
Back to top
View user's profile Send private message
fayettemat
Voice


Joined: 09 Jan 2007
Posts: 27

PostPosted: Sun Mar 04, 2007 12:18 am    Post subject: Reply with quote

if I bound this to a pubm bind and striped the colors and codes it would be a handy ban script wouldnt it? (the bots a server admin)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber