Code: Select all
# BanFIND by speechles
# no dolphins or walrus were harmed in the creation of this script ;)
bind pub - !bfind proc:banlist
proc proc:banlist {nick uhost hand chan text} {
set text [lindex [split $text] 0]
set mybans [banlist $chan]
if {[llength $mybans] > 0} {
set matches {}
foreach ban $mybans {
if {[string match -nocase $text [set bann [lindex $ban 0]]]} {
set banby [lindex $ban 5]
if {[set remain [expr [lindex $ban 2] - [unixtime]]] > 0} {
set remain "in [duration $remain]"
} else {
set remain "Never."
}
if {[string match "" [set reason [lindex $ban 1]]]} {
set reason "No reason given"
}
lappend matches [list "$bann" "$banby" "$remain" "$reason"]
}
}
if {[llength $matches] > 0} {
set i 1
puthelp "NOTICE $nick :\002Matching bans\002: \037[llength $matches]\037 for $text on $chan:"
foreach match $matches {
puthelp "NOTICE $nick :\002$i\002\) [lindex $match 0] \002By:\002 [lindex $match 1] \002Expires:\002 [lindex $match 2] \002Reason:\002 [lindex $match 3]"
incr i
}
} else {
puthelp "NOTICE $nick :There are \002no bans\002 matching \037$text\037 found on $chan."
}
} else {
puthelp "NOTICE $nick :There are \002no bans\002 placed for $chan. I cannot search for \037$text\037."
}
}
thanks speechles, but the script is not workingspeechles wrote:Code: Select all
bind pub - !whoban proc:banlist proc proc:banlist {nick uhost hand chan text} { set text [lindex [split $text] 0] set mybans [banlist $chan] if {[llength $mybans] > 0} { set matches {} foreach ban $mybans { if {[string match -nocase $text $ban]} { set bann [lindex $ban 0] set banby [nick2hand [lindex $ban 5] $chan] set remain [expr [lindex $ban 2] - [unixtime]] set reason [lindex $ban 1] if {$remain > 0} { set remain "in [duration $remain]." } { set remain "Never." } lappend matches [list "$bann" "$banby" "$remain" "$reason"] } } if {[llength $matches] > 0} { set i 1 puthelp "NOTICE $nick :\002Matching bans\002: \037[llength $matches]\037 for $text on $chan:" foreach match $matches { puthelp "NOTICE $nick :\002$i\002\) [lindex $match 0] \002By:\002 [lindex $match 1] \002Expires:\002 [lindex $match 2] \002Reason:\002 [lindex $match 3]" incr i } } else { puthelp "NOTICE $nick :There are \002no bans\002 matching \037$text\037 found on $chan." } } else { puthelp "NOTICE $nick :There are \002no bans\002 placed for $chan. I cannot search for \037$text\037." } }
Code: Select all
<eXtremer> !b *!*@test.com
*** Bot sets mode: +b *!*@test.com
-Bot- New mask added : *!*@test.com
<eXtremer> !find *!*@test.com
-Bot- There are no bans matching *!*@test.com found on #testbot.
Works just fine.. now. The problem stemmed from the fact I was trying to match against each ban sublist ([banlist $chan] is a list, with a sublist) with a string match (*slaps self hard*) which of course breaks a golden rule. You would've needed a * at the end of your query or it would've returned the no results found message. I've fixed this (USE THE EDITED CODE ABOVE I WROTE), it will work normally now and not under/over match as well as now obeys every golden rule of tcl.***dcc partyline***
<speechles> .+ban *!*@*host.com #test %365d0h0m year ban
<sp33chy> New #test ban: *!*@*host.com (year ban)
<speechles> .+ban nick!ident@host* #test goodbye
<sp33chy> New #test ban: nick!ident@host* (goodbye)
***in channel #test***
<speechles> !whoban *!*@*
-sp33chy- Matching bans: 2 for *!*@* on #test:
-sp33chy- 1) *!*@*host.com By: speechles Expires: in 52 weeks 23 hours 59 minutes 49 seconds. Reason: year ban
-sp33chy- 2) nick!ident@host* By: speechles Expires: Never. Reason: goodbye
Look:speechles wrote:Works just fine. Don't know what you've done to break it. This will ONLY list eggdrop internal bans. If it's setting the ban in the channel, or via X/chanserv, yeah, this will not work. If for eggdrop's internal ban list ONLY.***dcc partyline***
<speechles> .+ban *!*@*host.com #kangaroopocket %365d0h0m year ban
<sp33chy> New #test ban: *!*@*host.com (year ban)
<speechles> .+ban nick!ident@host* #test goodbye
<sp33chy> New #test ban: nick!ident@host* (goodbye)
***in channel #test***
<speechles> !whoban *!*@*
-sp33chy- Matching bans: 2 for *!*@* on #test:
-sp33chy- 1) *!*@*host.com By: speechles Expires: in 52 weeks 23 hours 59 minutes 49 seconds. Reason: year ban
-sp33chy- 2) nick!ident@host* By: speechles Expires: Never. Reason: goodbye
Perhaps that ban script you have isn't using eggdrops internal ban system, and instead just placing bans onto the channel with no rhyme or reason?
Also "-Bot- There are no bans matching *!*@test.com found on #testbot."
This indicates there are bans on the channel, just none matching what your searching. Try instead !find *!*@* so you can see ALL bans for that channel. Then you can see that this indeed does work.
Code: Select all
<eXtremer> !b *!*@host.com 0 bye
*** Bot sets mode: +b *!*@host.com
-Bot- New mask added : *!*@test.com
<eXtremer> !find *!*@host.com
-Bot- There are no bans matching *!*@host.com found on #testbot.
Code: Select all
<eXtremer> !find *!*@*
-Bot- Matching bans: 1 for *!*@* on #testbot:
-Bot- 1) *!*@host.com By: eXtremer Expires: Never. Reason: bye
Code: Select all
.+ban *!*@mail.com #testbot 1 go
[17:26] #eXtremer# (#Clas) +ban *!*@mail.com #testbot (1 go)
New #testbot ban: *!*@mail.com (1 go)
Code: Select all
<eXtremer> !find *!*@mail.com
-Bot- There are no bans matching *!*@mail.com found on #testbot.
Yes, ok speechles I'll overwrite the code, thanks again ;)_speechles wrote:I edited that post too late I see. Do you see now? Use the edited code I originally posted. It will work correctly now. Enjoy. Long live dolphins and walruses.speechles wrote:Works just fine.. now. The problem stemmed from the fact I was trying to match against each ban sublist ([banlist $chan] is a list, with a sublist) with a string match (*slaps self hard*) which of course breaks a golden rule. You would've needed a * at the end of your query or it would've returned the no results found message. I've fixed this (USE THE EDITED CODE ABOVE I WROTE), it will work normally now and not under/over match as well as now obeys every golden rule of tcl.***dcc partyline***
<speechles> .+ban *!*@*host.com #kangaroopocket %365d0h0m year ban
<sp33chy> New #test ban: *!*@*host.com (year ban)
<speechles> .+ban nick!ident@host* #test goodbye
<sp33chy> New #test ban: nick!ident@host* (goodbye)
***in channel #test***
<speechles> !whoban *!*@*
-sp33chy- Matching bans: 2 for *!*@* on #test:
-sp33chy- 1) *!*@*host.com By: speechles Expires: in 52 weeks 23 hours 59 minutes 49 seconds. Reason: year ban
-sp33chy- 2) nick!ident@host* By: speechles Expires: Never. Reason: goodbye