| View previous topic :: View next topic |
| Author |
Message |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Sat Apr 25, 2015 8:15 am Post subject: |
|
|
We can add some debugging if you would like to it to see it it's indeed something server side or bot side.  _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Sat Apr 25, 2015 9:55 am Post subject: |
|
|
| simo wrote: |
...
but its ok if theres any remaining ban left i ll remove manually
thnx again caesar |
Just curious -
If you immediately run it again (and again if necessary), what happens on each run? Does is remove some, part, or none?
This may be useful info for anyone that is trying to figure it out. _________________ 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 26, 2015 3:38 am Post subject: |
|
|
After or before the:
| Code: |
puthelp "MODE $chan -$mode $masks"
|
add the following line and do the !clarbans:
| Code: |
putlog "Clearbans: mode: $mode | masks: $masks"
|
and compare what you see in DCC Chat with it with what happens on the channel. _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Sun May 10, 2015 1:18 pm Post subject: |
|
|
| simo wrote: | | is there a way to make it clear all bans |
Let's try this Not using the eggdrop [chanbans $chan] command... | Code: |
# clearchanbans.tcl revisited #
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 clearbans($chan) [list 0]
bind raw - 367 cb:bind:raw
bind raw - 368 cb:bind:raw
putserv "MODE $chan b"
return 0
}
proc cb:bind:raw {from key text} {
global clearbans
lassign [split $text] not chan mask
if {![info exists clearbans($chan)]} { return 0 }
set masks [lassign $clearbans($chan) total]
if {$key == 367} {
lappend masks $mask ; incr total
}
set cnt [llength $masks]
if {$total == 0} {
puthelp "PRIVMSG $chan :$chan Bans list is empty."
} elseif {$cnt == $clearbans(max) || ($cnt>0 && $key==368)} {
set mode [string repeat "b" $cnt]
putserv "MODE $chan -$mode [join $masks]"
set clearbans($chan) [list $total]
} else {
set clearbans($chan) [linsert $masks 0 $total]
}
if {$key == 368} {
unset clearbans($chan)
unbind raw - 367 cb:bind:raw
unbind raw - 368 cb:bind:raw
puthelp "PRIVMSG $chan :Removed $total bans. $chan Bans list is empty."
}
return 1
}
|
_________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sun May 10, 2015 3:53 pm Post subject: |
|
|
| thnx spike^^ this one clears banlist leaving none fine job well done |
|
| Back to top |
|
 |
d3n Voice

Joined: 13 Jul 2016 Posts: 15 Location: Italy
|
Posted: Tue Aug 30, 2016 8:01 pm Post subject: |
|
|
| i put this file on my bot, but doesn't work :S and say anything... why? |
|
| Back to top |
|
 |
Arnold_X-P Master

Joined: 30 Oct 2006 Posts: 221 Location: DALnet - Trinidad - Beni - Bolivia
|
Posted: Tue Aug 30, 2016 11:42 pm Post subject: |
|
|
which tcl used... and it be fixed that error goes out for him so they help him..
to me me both work well _________________
thanks to that they help, that others learn  |
|
| Back to top |
|
 |
d3n Voice

Joined: 13 Jul 2016 Posts: 15 Location: Italy
|
Posted: Wed Aug 31, 2016 5:39 am Post subject: |
|
|
| Code: | # clearchanbans.tcl revisited #
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 clearbans($chan) [list 0]
bind raw - 367 cb:bind:raw
bind raw - 368 cb:bind:raw
putserv "MODE $chan b"
return 0
}
proc cb:bind:raw {from key text} {
global clearbans
lassign [split $text] not chan mask
if {![info exists clearbans($chan)]} { return 0 }
set masks [lassign $clearbans($chan) total]
if {$key == 367} {
lappend masks $mask ; incr total
}
set cnt [llength $masks]
if {$total == 0} {
puthelp "PRIVMSG $chan :$chan Bans list is empty."
} elseif {$cnt == $clearbans(max) || ($cnt>0 && $key==368)} {
set mode [string repeat "b" $cnt]
putserv "MODE $chan -$mode [join $masks]"
set clearbans($chan) [list $total]
} else {
set clearbans($chan) [linsert $masks 0 $total]
}
if {$key == 368} {
unset clearbans($chan)
unbind raw - 367 cb:bind:raw
unbind raw - 368 cb:bind:raw
puthelp "PRIVMSG $chan :Removed $total bans. $chan Bans list is empty."
}
return 1
} |
i put this, and i used eggdrop 1.6.21 ! this tcl doesn't work |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Wed Aug 31, 2016 1:39 pm Post subject: |
|
|
| d3n wrote: | | i put this, and i used eggdrop 1.6.21 ! this tcl doesn't work |
For anyone reading along:
I think that he had the channel name, when entered with .+chan
with the first letter in upper case.
$clearbans($chan) might be: #Channelname
when it was looking for: #channelname from the ircd.
Or vice versa... whew...
A line like this:
| Code: |
set chan [string tolower $chan]
|
in the right place, seemed to fix it. _________________ 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 |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Mon Feb 04, 2019 9:52 am Post subject: |
|
|
i dont know why lately this same exact code returns this error
| Quote: | | Tcl error [clear:bans]: wrong # args: should be "clear:bans nick uhost hand text" |
|
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Mon Feb 04, 2019 10:48 am Post subject: |
|
|
Do a .tcl $errorInfo from DCC Chat/Telnet with the bot when you see that error to track down the source of the issue.
Would also help if post what code you used, as me and Spike offered a few solution, granted his final one uses a different approach than what I suggested initially.
Here's my "version" that also relies on the raw 367 outputs from the server instead of bot's banlist.
| Code: |
set clearbans(max) 6
bind pub o|o !clearbans clear:bans
proc clear:bans {nick uhost hand chan text} {
global clearbans
set chan [string tolower $chan]
if {![botisop $chan]} return
set clearbans($chan) {}
bind raw - 367 cb:bind:raw
bind raw - 368 cb:bind:raw
putserv "MODE $chan b"
}
proc cb:bind:raw {from key text} {
global clearbans
switch -- $key {
367 {
lassign [split $text] bot chan mask
set chan [string tolower $chan]
if {![info exists clearbans($chan)]} return
if {[lsearch $clearbans($chan) $mask] > -1} return
lappend clearbans($chan) $mask
}
368 {
lassign [split $text] bot chan
set chan [string tolower $chan]
if {![info exists clearbans($chan)]} return
unbind raw - 367 cb:bind:raw
unbind raw - 368 cb:bind:raw
set len [llength $clearbans($chan)]
set total 0
if {$len > 0} {
while {$len > 0} {
if {$len > $clearbans(max)} {
set mode [string repeat "b" $clearbans(max)]
set masks [join [lrange $clearbans($chan) 0 [expr {$clearbans(max) - 1}]]]
set clearbans($chan) [lrange $clearbans($chan) $clearbans(max) end]
incr len -$clearbans(max)
incr total $clearbans(max)
} else {
set mode [string repeat "b" $len]
set masks [join $clearbans($chan)]
incr total $len
set len 0
}
puthelp "MODE $chan -$mode $masks"
}
} else {
puthelp "PRIVMSG $chan :Bans list is empty."
}
puthelp "PRIVMSG $chan :Removed $total bans and list is now empty."
}
}
}
|
Did minimal testing so reply back if you get any error.
Edit: Fixed. _________________ Once the game is over, the king and the pawn go back in the same box.
Last edited by caesar on Tue Feb 05, 2019 2:04 am; edited 1 time in total |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Mon Feb 04, 2019 2:05 pm Post subject: |
|
|
hey there caesar gettin this in return:
| Quote: | 19:04:18 <Cappuccino> Tcl error: invalid command name "wrong # args: should be "clear:bans nick uhost hand text"
19:04:18 <Cappuccino> Tcl error: while executing
19:04:18 <Cappuccino> Tcl error: "clear:bans $_pub1 $_pub2 $_pub3 $_pub4 $_pub5"" |
using your version returns me the same error |
|
| Back to top |
|
 |
Stefano1990 Voice
Joined: 04 Jun 2018 Posts: 25
|
Posted: Tue Feb 05, 2019 1:36 am Post subject: Hello |
|
|
the clearbans of ceasar show me this when i used again the public command !clearbans !cb .cb
and is not remove all bans need to retype same command
need to remove unban all bans #channel 10 20 30 max
and to have and 2 others option extra for specific user to unban !unban !ub .ub nick
and if on channel status ban have up on 1 hour bans to remove it automatically
if is possbible to fix it thx in advance
with set clearbans(max) 12
removing 24 ban and remains some others on ban when i retype second time same !clearbans is show me this on PL
| Quote: |
Tcl error [cb:bind:raw]: wrong # args: should be "incr varName ?increment?"
|
| Quote: |
[07:50:18] <Jupiter> !clearbans
[07:50:18] * TEST sets mode: -bbbbbbbbbbbb *!*@Test.com-auy.493.44.63.IP *!*@Test.com-119.446.34.43.IP *!*@Test.com-e16.301.24.70.IP *!*@Test.com-3qe.231.01.58.IP *!*@Test.com-iad.991.65.43.IP *!*@Test.com-864.736.99.51.IP *!*@Test.com-k0a.858.08.93.IP *!*@Test.com-nqm.630.94.98.IP *!*@Test.com-gb1.376.93.25.IP *!*@Test.com-r08.604.99.34.IP *!*@Test.com-06c.073.85.59.IP ~q:*!*@Test.com-4cu.725.79.52.IP
[07:50:18] * TEST sets mode: -bbbbbbbbbbbb *!*@Test.com-082.554.45.60.IP *!*@Test.com-5yb.488.57.95.IP ~q:*!*@Test.com-pp2.301.69.59.IP ~q:*!*@Test.com-hfz.047.53.28.IP ~q:*!*@Test.com-ufb.604.06.85.IP ~q:*!*@Test.com-c02.400.26.20.IP ~q:*!*@Test.com-22n.154.50.91.IP ~q:*!*@Test.com-7k1.596.54.91.IP ~q:*!*@Test.com-p8v.513.59.32.IP ~q:*!*@Test.com-827.144.52.27.IP ~q:*!*@Test.com-8p0.118.97.15.IP *!*@Test.com-429.729.78.47.IP
[07:51:05] <Jupiter> !clearbans
|
_________________ Use your common sense and try not to make me look too much like I know what I'm doing. |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Tue Feb 05, 2019 2:07 am Post subject: |
|
|
@simo Sounds like you have two procs with the same name. By any chance you have this one? Try unloading all scripts and leave only this one and see if you still get the error. A fix for this issue would be to get everything into a namespace.
@Stefano1990 Yeah, my bad. Locate:
| Code: |
incr total $clearbans(max) $len
|
and replace it with:
Did a copy/paste and forgot to remove $clearbans(max). Now it should remove everything nicely. _________________ Once the game is over, the king and the pawn go back in the same box.
Last edited by caesar on Tue Feb 05, 2019 2:43 am; edited 1 time in total |
|
| Back to top |
|
 |
Stefano1990 Voice
Joined: 04 Jun 2018 Posts: 25
|
Posted: Tue Feb 05, 2019 2:27 am Post subject: Hello |
|
|
hello ceasar now its works look great job thx ,
| Code: |
[08:23:27] Jupiter !clearbans
[08:23:27] * TEST sets mode: -bbbbbbbbbbbb ~q:*!*@Test.com-4cu.725.79.52.IP *!*@Test.com-06c.073.85.59.IP *!*@Test.com-r08.604.99.34.IP *!*@Test.com-gb1.376.93.25.IP *!*@Test.com-nqm.630.94.98.IP *!*@Test.com-k0a.858.08.93.IP *!*@Test.com-864.736.99.51.IP *!*@Test.com-iad.991.65.43.IP *!*@Test.com-3qe.231.01.58.IP *!*@Test.com-e16.301.24.70.IP *!*@Test.com-119.446.34.43.IP *!*@Test.com-auy.493.44.63.IP
[08:23:27] * TEST sets mode: -bbbbbbbbbbbb ~q:*!*@Test.com-hfz.047.53.28.IP ~q:*!*@Test.com-pp2.301.69.59.IP *!*@Test.com-5yb.488.57.95.IP *!*@Test.com-082.554.45.60.IP *!*@Test.com-429.729.78.47.IP ~q:*!*@Test.com-8p0.118.97.15.IP ~q:*!*@Test.com-827.144.52.27.IP ~q:*!*@Test.com-p8v.513.59.32.IP ~q:*!*@Test.com-7k1.596.54.91.IP ~q:*!*@Test.com-22n.154.50.91.IP ~q:*!*@Test.com-c02.400.26.20.IP ~q:*!*@Test.com-ufb.604.06.85.IP
[08:23:27] * TEST sets mode: -b *!*@Test.com-i49.482.76.85.IP
[08:23:27] * &TEST Removed 25 bans and list is now empty.
|
but can u add and 2 options and to unban a simple user . ! ub nick not other bans and when the bans have 1 hour and more to remove automatically all bans
thx in advance _________________ Use your common sense and try not to make me look too much like I know what I'm doing. |
|
| Back to top |
|
 |
|