| View previous topic :: View next topic |
| Author |
Message |
Arnold_X-P Master

Joined: 30 Oct 2006 Posts: 221 Location: DALnet - Trinidad - Beni - Bolivia
|
Posted: Sat Apr 18, 2015 4:32 pm Post subject: clearbans it's not working |
|
|
good morning to all
I found this tcl that cleans the channels bans
I used it and began my eggdrop again but the tcl never worked.
my eggdrop is 6.21
| Quote: |
[16:23] * sedition sets mode: +b mmmmdd!*@*
[16:23] * sedition sets mode: +b *!*@200.36.689.3
[16:23] <sedition> !op
[16:26] * JulieTh sets mode: +o sedition
[16:27] * sedition sets mode: +b *!*@200.36.689.3669
[16:27] * sedition sets mode: +b utee!*@*
[16:27] <@sedition> !clearbans
|
he would be grateful to them very much if someone makes her work
| Code: |
# Author: tomekk
# e-mail: tomekk/@/oswiecim/./eu/./org
# home page: http://tomekk.oswiecim.eu.org/
#
# Version 0.1
#
# This file is Copyrighted under the GNU Public License.
# http://www.gnu.org/copyleft/gpl.html
##############################################
################
bind pub o|o !clearbans cb
proc cb { nick uhost hand chan arg } {
foreach global_ban [banlist] {
killban [lindex $global_ban 0]
}
foreach chan_ban [channels] {
foreach ban [banlist $chan_ban] {
killchanban $chan_ban [lindex $ban 0]
}
}
}
putlog "cb.tcl ver 0.1 by tomekk loaded"
|
_________________
thanks to that they help, that others learn  |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Sat Apr 18, 2015 5:21 pm Post subject: Re: clearbans it's not working |
|
|
| Arnold_X-P wrote: |
...
| Code: |
foreach chan_ban [channels] {
foreach ban [banlist $chan_ban] {
killchanban $chan_ban [lindex $ban 0]
}
}
|
...
|
I suspect the above section.
Try replacing it with this:
| Code: |
foreach c [channels] {
if {[botonchan $c]} {
foreach chan_ban [chanbans $c] {
pushmode $c -b [lindex $chan_ban 0]
}
}
}
|
This is untested.
You need to test it carefully.
I hope this helps. _________________ For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia ! |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Sat Apr 18, 2015 6:41 pm Post subject: |
|
|
The script looks fine as it was first written, it cleans up the bot's internal ban list.
That has nothing to do with the current bans set on any channel on irc:) _________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Sat Apr 18, 2015 11:02 pm Post subject: |
|
|
| SpiKe^^ wrote: |
...
That has nothing to do with the current bans set on any channel on irc:) |
Yep. Exactly. And I suspect that is what he is looking for. _________________ For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia ! |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Sun Apr 19, 2015 5:43 am Post subject: |
|
|
| Code: |
set clearbans(max) 6
bind pub o|o !clearbans clear:bans
proc clear:bans {nick uhost hand chan text} {
global clearbans
if {![botisop $chan]} return
set banlist [chanbans $chan]
set len [llength $banlist]
while {$len > 0} {
if {$len > $clearbans(max)} {
set mode [string repeat "b" $clearbans(max)]
set masks [join [lrange $banlist 0 [expr {$clearbans(max) - 1}]]]
set banlist [lrange $banlist $clearbans(max) end]
incr len -$clearbans(max)
} else {
set mode [string repeat "b" $len]
set masks [join $banlist]
set len 0
}
pushmode $chan -$mode $masks
}
}
|
Set clearbans(max) to match the max amount of ban modes per line the IRC Server you are connected to. _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
Arnold_X-P Master

Joined: 30 Oct 2006 Posts: 221 Location: DALnet - Trinidad - Beni - Bolivia
|
Posted: Sun Apr 19, 2015 11:16 am Post subject: Re: clearbans it's not working |
|
|
thanks willyw SpiKe^^ (my bros) caesar
thank you very much  _________________
thanks to that they help, that others learn  |
|
| Back to top |
|
 |
Arnold_X-P Master

Joined: 30 Oct 2006 Posts: 221 Location: DALnet - Trinidad - Beni - Bolivia
|
Posted: Sun Apr 19, 2015 11:40 am Post subject: Re: clearbans it's not working |
|
|
[11:19] * sedition sets mode: +b *!*@233.86.69.3
[11:19] * sedition sets mode: +b *!*@233.86.69.3ddd
[11:19] * sedition sets mode: +b lucas!*@*
[11:25] * sedition sets mode: +b mmss!*@*
[11:25] * sedition sets mode: +b mmsssss!*@*
[11:25] * sedition sets mode: +b pols!*@*
[11:25] * sedition sets mode: +b stim!*@*
[11:36] <@sedition> !clearbans
[11:37] * sedition sets mode: +b bopm!*@*
[11:37] * sedition sets mode: +b bopm39!*@*
I proved both suggestions and none worked it does not remove the bans _________________
thanks to that they help, that others learn  |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Sun Apr 19, 2015 12:10 pm Post subject: Re: clearbans it's not working |
|
|
| Arnold_X-P wrote: |
...
I proved both suggestions and none worked it does not remove the bans
|
Tested this:
| Code: |
foreach c [channels] {
if {[botonchan $c]} {
foreach chan_ban [chanbans $c] {
pushmode $c -b [lindex $chan_ban 0]
}
}
}
|
from earlier post.
It works for me. Removes channel bans (not bans within the bot)
Post your complete script, just as it was when you tested it.
p.s.
Please clarify:
You want to remove bans set within the bot?
You want to remove bans set by channel Ops, on the channel?
You want to remove both? _________________ For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia ! |
|
| Back to top |
|
 |
Arnold_X-P Master

Joined: 30 Oct 2006 Posts: 221 Location: DALnet - Trinidad - Beni - Bolivia
|
Posted: Sun Apr 19, 2015 6:19 pm Post subject: Re: clearbans it's not working |
|
|
I want that it removes or removes both bans
its writing does not work
begin my eggdrop again and try and it does not work  _________________
thanks to that they help, that others learn  |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Sun Apr 19, 2015 7:11 pm Post subject: |
|
|
Let's work a little with Caesar's code:) | Code: |
set clearbans(max) 6
bind pub o|o !clearbans clear:bans
proc clear:bans {nick uhost hand chan text} {
global clearbans
if {![botisop $chan]} return
set banlist [chanbans $chan]
set blist ""
set modes ""
foreach ban $banlist {
append modes b
lappend blist [lindex $ban 0]
if {[llength $blist] == $clearbans(max)} {
putserv "MODE $chan -$modes [join $blist]"
set blist ""
set modes ""
}
}
if {[llength $blist] > 0} {
putserv "MODE $chan -$modes [join $blist]"
}
return 0
}
|
Set clearbans(max) to match the max amount of ban modes per line the IRC Server you are connected to. _________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
Arnold_X-P Master

Joined: 30 Oct 2006 Posts: 221 Location: DALnet - Trinidad - Beni - Bolivia
|
Posted: Sun Apr 19, 2015 7:33 pm Post subject: clearbans it's not working - solved |
|
|
thanks SpiKe^^
thank you friend you are a genius ..
[19:30] <@sedition> !clearbans
[19:30] * JulieTh sets mode: -bbbb dompe!*@* mdmmdd!*@* *!*@52.36.988. *!*@52.36.988.8 _________________
thanks to that they help, that others learn  |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Mon Apr 20, 2015 12:53 am Post subject: |
|
|
| Code: |
set clearbans(max) 6
bind pub - !clearbans clear:bans
proc clear:bans {nick uhost hand chan text} {
global clearbans
if {![botisop $chan]} return
foreach {ban bywho age} [join [chanbans $chan]] {
lappend banlist $ban
}
set len [llength $banlist]
while {$len > 0} {
if {$len > $clearbans(max)} {
set mode [string repeat "b" $clearbans(max)]
set masks [join [lrange $banlist 0 [expr {$clearbans(max) - 1}]]]
set banlist [lrange $banlist $clearbans(max) end]
incr len -$clearbans(max)
} else {
set mode [string repeat "b" $len]
set masks [join $banlist]
set len 0
}
puthelp "MODE $chan -$mode $masks"
}
}
|
And I'm an idiot cos rushed and forgot that chanbans returns an array with 3 elements (ban, by who and seconds) for each ban.
Switched to puthelp cos for some reason that I don't understand right now the pushmode doesn't do anything although the variables are ok and should work, yet nothing happens. No error, no nothing.
Added a:
| Code: |
putlog "mode $chan -$mode $masks"
|
for debugging purposes and see the mode change just fine in party-line:
| Quote: |
[04:56:52] mode #chan -bbbbbb *!*@6 *!*@5 *!*@4 *!*@3 *!*@2 *!*@1
[04:56:52] mode #chan -bbbbbb *!*@12 *!*@11 *!*@10 *!*@9 *!*@8 *!*@7
[04:56:52] mode #chan -bbbbb *!*@17 *!*@16 *!*@15 *!*@14 *!*@13
|
yet nothing happens on the channel. But as soon as switch to puthelp i see the mode change on the channel as well:
| Quote: |
[08:00:44] <@cez> !clearbans
[08:00:44] * Bot sets mode: -bbbbbb *!*@1 *!*@2 *!*@3 *!*@4 *!*@5 *!*@6
[08:00:46] * Bot sets mode: -bbbbbb *!*@7 *!*@8 *!*@9 *!*@10 *!*@11 *!*@12
[08:00:48] * Bot sets mode: -bbbbb *!*@13 *!*@14 *!*@15 *!*@16 *!*@17
|
Anyone can shed some light on this? Eggdrop v1.6.21. TCL 8.6.1. _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
Arnold_X-P Master

Joined: 30 Oct 2006 Posts: 221 Location: DALnet - Trinidad - Beni - Bolivia
|
Posted: Mon Apr 20, 2015 7:14 pm Post subject: |
|
|
but the tcl lacks something more a little that newly it notices today
that happens if the list of bans this empty absence that more to add
example:
[19:09] <@sedition> !clearbans
[19:13] <@JulieTh> #tcls Bans list is empty. _________________
thanks to that they help, that others learn  |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Mon Apr 20, 2015 9:06 pm Post subject: |
|
|
| Code: |
set clearbans(max) 6
bind pub o|o !clearbans clear:bans
proc clear:bans {nick uhost hand chan text} {
global clearbans
if {![botisop $chan]} { return 0 }
set banlist [chanbans $chan]
if {![llength $banlist]} {
puthelp "PRIVMSG $chan :$chan Bans list is empty."
return 0
}
set blist ""
set modes ""
foreach ban $banlist {
append modes b
lappend blist [lindex $ban 0]
if {[llength $blist] == $clearbans(max)} {
putserv "MODE $chan -$modes [join $blist]"
set blist ""
set modes ""
}
}
if {[llength $blist] > 0} {
putserv "MODE $chan -$modes [join $blist]"
}
return 0
}
|
_________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
Arnold_X-P Master

Joined: 30 Oct 2006 Posts: 221 Location: DALnet - Trinidad - Beni - Bolivia
|
Posted: Mon Apr 20, 2015 10:22 pm Post subject: |
|
|
quite very well you achieved it
once again thanks for the help friend..
[22:20] * sedition sets mode: +b k!*@*
[22:20] <@sedition> !clearbans
[22:20] * JulieTh sets mode: -b k!*@*
[22:20] <@sedition> !clearbans
[22:20] <@JulieTh> #bom Bans list is empty. _________________
thanks to that they help, that others learn  |
|
| Back to top |
|
 |
|