| View previous topic :: View next topic |
| Author |
Message |
fayettemat Voice
Joined: 09 Jan 2007 Posts: 27
|
Posted: Tue Feb 27, 2007 1:33 pm Post subject: Doing a whois to print out to a file |
|
|
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 |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
|
| Back to top |
|
 |
et109 Voice

Joined: 25 Feb 2007 Posts: 7 Location: Pennsylavnia
|
Posted: Tue Feb 27, 2007 2:33 pm Post subject: whois info |
|
|
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 |
|
 |
fayettemat Voice
Joined: 09 Jan 2007 Posts: 27
|
Posted: Tue Feb 27, 2007 3:09 pm Post subject: |
|
|
| 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 |
|
 |
rosc2112 Revered One

Joined: 19 Feb 2006 Posts: 1454 Location: Northeast Pennsylvania
|
Posted: Tue Feb 27, 2007 4:51 pm Post subject: |
|
|
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 |
|
 |
fayettemat Voice
Joined: 09 Jan 2007 Posts: 27
|
Posted: Tue Feb 27, 2007 6:02 pm Post subject: |
|
|
| 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 |
|
 |
rosc2112 Revered One

Joined: 19 Feb 2006 Posts: 1454 Location: Northeast Pennsylvania
|
|
| Back to top |
|
 |
fayettemat Voice
Joined: 09 Jan 2007 Posts: 27
|
Posted: Sun Mar 04, 2007 12:18 am Post subject: |
|
|
| 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 |
|
 |
|