| View previous topic :: View next topic |
| Author |
Message |
eXtremer Op
Joined: 07 May 2008 Posts: 138
|
Posted: Thu Jul 17, 2008 1:50 am Post subject: Who banned script [!whoban <mask>] - public cmd. |
|
|
Hi all.
I need a script that will find a ban in the banlist.
For example:
<Me> !whoban *!*@host.com
now the bot will msg me via notice
<Bot> *!*@host.com was banned by: Me Expire: expires in 2 days 3 hours 15 minutes. Reason: No Reason.
I have the !banlist cmd, but it shows me all the bans & if the banlist is big, it's really annoying !
Waiting for a reply.
P.S.: "banned by" must show the handle not the nick.
Thanks in advance. |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Thu Jul 17, 2008 2:39 am Post subject: |
|
|
| Code: | # 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."
}
} |
Edited to correct minor problems mentioned below. Now functional 100% and elegantly  _________________ speechles' eggdrop tcl archive
Last edited by speechles on Fri Jul 18, 2008 9:05 pm; edited 8 times in total |
|
| Back to top |
|
 |
eXtremer Op
Joined: 07 May 2008 Posts: 138
|
Posted: Fri Jul 18, 2008 3:27 am Post subject: |
|
|
| speechles wrote: | | Code: | 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."
}
} |
|
thanks speechles, but the script is not working
| Code: |
<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. |
What's wrong ?
P.S.: I replaced the "!whoban" cmd with "!find" command. |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Fri Jul 18, 2008 9:30 am Post subject: |
|
|
| Quote: | ***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 |
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.  _________________ speechles' eggdrop tcl archive
Last edited by speechles on Fri Jul 18, 2008 3:48 pm; edited 1 time in total |
|
| Back to top |
|
 |
eXtremer Op
Joined: 07 May 2008 Posts: 138
|
Posted: Fri Jul 18, 2008 10:33 am Post subject: |
|
|
| speechles wrote: | | Quote: | ***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 |
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.
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. |
Look:
Channel:
| Code: | <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.
|
if *!*@* it works
| Code: | <eXtremer> !find *!*@*
-Bot- Matching bans: 1 for *!*@* on #testbot:
-Bot- 1) *!*@host.com By: eXtremer Expires: Never. Reason: bye |
DCC:
| Code: | .+ban *!*@mail.com #testbot 1 go
[17:26] #eXtremer# (#Clas) +ban *!*@mail.com #testbot (1 go)
New #testbot ban: *!*@mail.com (1 go) |
| Code: | <eXtremer> !find *!*@mail.com
-Bot- There are no bans matching *!*@mail.com found on #testbot. |
I don't really understand... |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Fri Jul 18, 2008 10:35 am Post subject: |
|
|
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' eggdrop tcl archive
Last edited by speechles on Fri Jul 18, 2008 3:48 pm; edited 1 time in total |
|
| Back to top |
|
 |
eXtremer Op
Joined: 07 May 2008 Posts: 138
|
Posted: Fri Jul 18, 2008 10:51 am Post subject: |
|
|
| speechles wrote: | | speechles wrote: | | Quote: | ***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 |
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.  |
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. |
Yes, ok speechles I'll overwrite the code, thanks again _ |
|
| Back to top |
|
 |
|