egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

clearbans it's not working
Goto page Previous  1, 2, 3, 4  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3584
Location: Mint Factory

PostPosted: Tue Apr 21, 2015 12:45 am    Post subject: Reply with quote

Code:

set clearbans(max) 6

bind pub - !clearbans clear:bans

proc clear:bans {nick uhost hand chan text} {
   global clearbans
   if {![botisop $chan]} return
   set chanbans [chanbans $chan]
   set len [llength $chanbans]
   if {!$len} {
      puthelp "PRIVMSG $chan :Bans list is empty."
      return
   }
   foreach {ban bywho age} [join $chanbans] {
      lappend banlist $ban
   }
   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"
   }
}

Quote:

[07:48:01] * cez sets mode: +bbbbbb *!*@5 *!*@6 *!*@7 *!*@8 *!*@9 *!*@10
[07:48:07] * cez sets mode: +bbbb *!*@1 *!*@2 *!*@3 *!*@4
[07:48:56] <@cez> !clearbans
[07:48:56] * Bot sets mode: -bbbbbb *!*@10 *!*@9 *!*@8 *!*@7 *!*@6 *!*@5
[07:48:58] * Bot sets mode: -bbbb *!*@4 *!*@3 *!*@2 *!*@1
[07:49:00] <@cez> !clearbans
[07:49:00] <@Bot> Bans list is empty.

_________________
I tawt I taw a puddy tat!
Back to top
View user's profile Send private message
simo
Master


Joined: 22 Mar 2015
Posts: 330

PostPosted: Tue Apr 21, 2015 7:08 am    Post subject: Reply with quote

i was wondering why it always leaves some bans left and doest clear all bans ?

also it seems anyone can clear bans
Back to top
View user's profile Send private message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 607
Location: Tennessee, USA

PostPosted: Tue Apr 21, 2015 8:29 am    Post subject: Reply with quote

Quote:
i was wondering why it always leaves some bans left and doest clear all bans ?
Which one of these scripts are you commenting on?

Quote:
also it seems anyone can clear bans
My public command is limited to o|o
_________________
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Back to top
View user's profile Send private message Visit poster's website
simo
Master


Joined: 22 Mar 2015
Posts: 330

PostPosted: Tue Apr 21, 2015 9:03 am    Post subject: Reply with quote

i was refer to:
Code:
set clearbans(max) 6

bind pub - !clearbans clear:bans

proc clear:bans {nick uhost hand chan text} {
   global clearbans
   if {![botisop $chan]} return
   set chanbans [chanbans $chan]
   set len [llength $chanbans]
   if {!$len} {
      puthelp "PRIVMSG $chan :Bans list is empty."
      return
   }
   foreach {ban bywho age} [join $chanbans] {
      lappend banlist $ban
   }
   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"
   }
}
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3584
Location: Mint Factory

PostPosted: Tue Apr 21, 2015 11:38 am    Post subject: Reply with quote

Yeah, my fault there. On the test bot don't have access to it so had to leave it blank for debugging. Replace the "-" in
Code:

bind pub - !clearbans clear:bans

with something you like, for instance o|o to allow only local and global users with "o" flag to do that cleaning.
_________________
I tawt I taw a puddy tat!
Back to top
View user's profile Send private message
simo
Master


Joined: 22 Mar 2015
Posts: 330

PostPosted: Tue Apr 21, 2015 11:41 am    Post subject: Reply with quote

works nice caesar only it doesnt seem to clear all bans
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3584
Location: Mint Factory

PostPosted: Tue Apr 21, 2015 12:01 pm    Post subject: Reply with quote

Really? It should. Don't see any reasons it shouldn't. Care to share some of the bans that aren't lifted? maybe I'm missing something.
_________________
I tawt I taw a puddy tat!
Back to top
View user's profile Send private message
simo
Master


Joined: 22 Mar 2015
Posts: 330

PostPosted: Tue Apr 21, 2015 2:25 pm    Post subject: Reply with quote

this is an example:

last ones i had to remove manually myselve

Quote:
20:23:14 AmaziGH Sets Mode on #servernet to: +bbbbbbbbbbbbbbb *!*@ServerNet-nw2.306.31.32.IP *!*@ServerNet-6yf.996.67.52.IP *!*@ServerNet-65h.270.93.88.IP *!*@ServerNet-gw4.255.78.85.IP *!*@ServerNet-20s.322.67.09.IP *!*@ServerNet-3pm.573.54.19.IP *!*@ServerNet-m96.584.30.96.IP *!*@ServerNet-5h7.567.17.15.IP *!*@ServerNet-aph.345.71.65.IP *!*@ServerNet-6v2.134.07.52.IP *!*@ServerNet-x10.424.75.92.IP *!*@ServerNet-929.684.29.67.IP *!*@ServerNet-a8q.384.05.73.IP *!*@ServerNet-e0x.855.57.99.IP *!*@Serv
20:23:14 AmaziGH Sets Mode on #servernet to: +bbbbbbbbbbbbbbb *!*@ServerNet-7vy.250.78.84.IP *!*@ServerNet-ny3.519.27.30.IP *!*@ServerNet-9y7.117.89.68.IP *!*@ServerNet-428.964.81.58.IP *!*@ServerNet-5pz.964.12.89.IP *!*@ServerNet-d80.586.43.90.IP *!*@ServerNet-8ax.895.02.10.IP *!*@ServerNet-lhk.173.07.82.IP *!*@ServerNet-u6a.859.65.69.IP *!*@ServerNet-4lk.857.05.09.IP *!*@ServerNet-uwd.850.13.71.IP *!*@ServerNet-a7y.401.71.60.IP *!*@ServerNet-x75.265.80.44.IP *!*@ServerNet-ihi.957.85.85.IP *!*@Serv
20:23:14 AmaziGH Sets Mode on #servernet to: +bbbbbbbbbbbbbbb *!*@ServerNet-857.688.05.84.IP *!*@ServerNet-l9b.666.65.96.IP *!*@ServerNet-295.092.61.00.IP *!*@ServerNet-r89.545.76.68.IP *!*@ServerNet-956.593.88.84.IP *!*@ServerNet-739.155.90.66.IP *!*@ServerNet-0u6.010.74.63.IP *!*@ServerNet-2j0.486.14.37.IP *!*@ServerNet-2qg.395.54.78.IP *!*@ServerNet-d90.320.18.31.IP *!*@ServerNet-532.443.07.22.IP *!*@ServerNet-am0.403.63.16.IP *!*@ServerNet-o42.086.68.66.IP *!*@ServerNet-8j8.212.02.18.IP *!*@Serv
20:23:15 AmaziGH Sets Mode on #servernet to: +bbbbb *!*@ServerNet-3fz.369.64.30.IP *!*@ServerNet-z34.181.57.95.IP *!*@ServerNet-o41.840.38.06.IP *!*@ServerNet-u09.760.22.12.IP *!*@ServerNet-83z.908.06.67.IP
20:23:20 (AmaziGH) : !clearbans
20:23:20 &SeCuRiTy Sets Mode on #servernet to: -bbbbbbbbb *!*@ServerNet-nw2.306.31.32.IP *!*@ServerNet-6yf.996.67.52.IP *!*@ServerNet-65h.270.93.88.IP *!*@ServerNet-gw4.255.78.85.IP *!*@ServerNet-20s.322.67.09.IP *!*@ServerNet-3pm.573.54.19.IP *!*@ServerNet-m96.584.30.96.IP *!*@ServerNet-5h7.567.17.15.IP *!*@ServerNet-aph.345.71.65.IP
20:23:20 &SeCuRiTy Sets Mode on #servernet to: -bbbbbbbbbbbbbbb *!*@ServerNet-6v2.134.07.52.IP *!*@ServerNet-x10.424.75.92.IP *!*@ServerNet-929.684.29.67.IP *!*@ServerNet-a8q.384.05.73.IP *!*@ServerNet-e0x.855.57.99.IP *!*@ServerNet-7vy.250.78.84.IP *!*@ServerNet-ny3.519.27.30.IP *!*@ServerNet-9y7.117.89.68.IP *!*@ServerNet-428.964.81.58.IP *!*@ServerNet-5pz.964.12.89.IP *!*@ServerNet-d80.586.43.90.IP *!*@ServerNet-8ax.895.02.10.IP *!*@ServerNet-lhk.173.07.82.IP *!*@ServerNet-u6a.859.65.69.IP *!*@ServerNet-4lk
20:23:20 &SeCuRiTy Sets Mode on #servernet to: -bbbbbbbbbbbbbbb *!*@ServerNet-uwd.850.13.71.IP *!*@ServerNet-a7y.401.71.60.IP *!*@ServerNet-x75.265.80.44.IP *!*@ServerNet-ihi.957.85.85.IP *!*@ServerNet-857.688.05.84.IP *!*@ServerNet-l9b.666.65.96.IP *!*@ServerNet-295.092.61.00.IP *!*@ServerNet-r89.545.76.68.IP *!*@ServerNet-956.593.88.84.IP *!*@ServerNet-739.155.90.66.IP *!*@ServerNet-0u6.010.74.63.IP *!*@ServerNet-2j0.486.14.37.IP *!*@ServerNet-2qg.395.54.78.IP *!*@ServerNet-d90.320.18.31.IP *!*@ServerNet-532
20:23:20 &SeCuRiTy Sets Mode on #servernet to: -bbbbbbbb *!*@ServerNet-am0.403.63.16.IP *!*@ServerNet-o42.086.68.66.IP *!*@ServerNet-8j8.212.02.18.IP *!*@ServerNet-3fz.369.64.30.IP *!*@ServerNet-z34.181.57.95.IP *!*@ServerNet-o41.840.38.06.IP *!*@ServerNet-u09.760.22.12.IP *!*@ServerNet-83z.908.06.67.IP

20:24:48 OperServ Sets Mode on #servernet to: -bbb *!*@ServerNet-6eh.222.56.32.IP *!*@ServerNet-k61.482.40.26.IP *!*@ServerNet-8v5.602.49.99.IP
Back to top
View user's profile Send private message
simo
Master


Joined: 22 Mar 2015
Posts: 330

PostPosted: Wed Apr 22, 2015 10:48 am    Post subject: Reply with quote

is there a way to make it clear all bans
Back to top
View user's profile Send private message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 607
Location: Tennessee, USA

PostPosted: Wed Apr 22, 2015 5:23 pm    Post subject: Reply with quote

Why not use mine that works...
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
View user's profile Send private message Visit poster's website
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3584
Location: Mint Factory

PostPosted: Thu Apr 23, 2015 12:55 am    Post subject: Reply with quote

This makes no sense. I've added about all the bans you quoted above and all where removed.
Quote:

[07:49:27] <@cez> !clearbans
[07:49:28] <@Bot> Bans list is empty.
[07:49:39] * cez sets mode: +bbbbbb *!*@ServerNet-nw2.306.31.32.IP *!*@ServerNet-6yf.996.67.52.IP *!*@ServerNet-65h.270.93.88.IP *!*@ServerNet-gw4.255.78.85.IP *!*@ServerNet-20s.322.67.09.IP *!*@ServerNet-3pm.573.54.19.IP
[07:49:57] * cez sets mode: +bbbbbb *!*@ServerNet-m96.584.30.96.IP *!*@ServerNet-5h7.567.17.15.IP *!*@ServerNet-aph.345.71.65.IP *!*@ServerNet-6v2.134.07.52.IP *!*@ServerNet-x10.424.75.92.IP *!*@ServerNet-929.684.29.67.IP
[07:49:59] * cez sets mode: +bbbbbb *!*@ServerNet-a8q.384.05.73.IP *!*@ServerNet-e0x.855.57.99.IP *!*@ServerNet-7vy.250.78.84.IP *!*@ServerNet-ny3.519.27.30.IP *!*@ServerNet-9y7.117.89.68.IP *!*@ServerNet-428.964.81.58.IP
[07:50:02] * cez sets mode: +bbbbbb *!*@ServerNet-5pz.964.12.89.IP *!*@ServerNet-d80.586.43.90.IP *!*@ServerNet-8ax.895.02.10.IP *!*@ServerNet-lhk.173.07.82.IP *!*@ServerNet-u6a.859.65.69.IP *!*@ServerNet-4lk.857.05.09.IP
[07:50:04] * cez sets mode: +bbbbbb *!*@ServerNet-uwd.850.13.71.IP *!*@ServerNet-a7y.401.71.60.IP *!*@ServerNet-x75.265.80.44.IP *!*@ServerNet-ihi.957.85.85.IP *!*@ServerNet-857.688.05.84.IP *!*@ServerNet-l9b.666.65.96.IP
[07:50:07] * cez sets mode: +bbbbbb *!*@ServerNet-295.092.61.00.IP *!*@ServerNet-r89.545.76.68.IP *!*@ServerNet-956.593.88.84.IP *!*@ServerNet-739.155.90.66.IP *!*@ServerNet-0u6.010.74.63.IP *!*@ServerNet-2j0.486.14.37.IP
[07:50:09] * cez sets mode: +bbbbbb *!*@ServerNet-2qg.395.54.78.IP *!*@ServerNet-d90.320.18.31.IP *!*@ServerNet-532.443.07.22.IP *!*@ServerNet-am0.403.63.16.IP *!*@ServerNet-o42.086.68.66.IP *!*@ServerNet-8j8.212.02.18.IP
[07:50:19] <@cez> !clearbans
[07:50:22] * Bot sets mode: -bbbbbb *!*@ServerNet-3pm.573.54.19.IP *!*@ServerNet-20s.322.67.09.IP *!*@ServerNet-gw4.255.78.85.IP *!*@ServerNet-65h.270.93.88.IP *!*@ServerNet-6yf.996.67.52.IP *!*@ServerNet-nw2.306.31.32.IP
[07:50:25] * Bot sets mode: -bbbbbb *!*@ServerNet-929.684.29.67.IP *!*@ServerNet-x10.424.75.92.IP *!*@ServerNet-6v2.134.07.52.IP *!*@ServerNet-aph.345.71.65.IP *!*@ServerNet-5h7.567.17.15.IP *!*@ServerNet-m96.584.30.96.IP
[07:50:28] * Bot sets mode: -bbbbbb *!*@ServerNet-428.964.81.58.IP *!*@ServerNet-9y7.117.89.68.IP *!*@ServerNet-ny3.519.27.30.IP *!*@ServerNet-7vy.250.78.84.IP *!*@ServerNet-e0x.855.57.99.IP *!*@ServerNet-a8q.384.05.73.IP
[07:50:31] * Bot sets mode: -bbbbbb *!*@ServerNet-4lk.857.05.09.IP *!*@ServerNet-u6a.859.65.69.IP *!*@ServerNet-lhk.173.07.82.IP *!*@ServerNet-8ax.895.02.10.IP *!*@ServerNet-d80.586.43.90.IP *!*@ServerNet-5pz.964.12.89.IP
[07:50:34] * Bot sets mode: -bbbbbb *!*@ServerNet-l9b.666.65.96.IP *!*@ServerNet-857.688.05.84.IP *!*@ServerNet-ihi.957.85.85.IP *!*@ServerNet-x75.265.80.44.IP *!*@ServerNet-a7y.401.71.60.IP *!*@ServerNet-uwd.850.13.71.IP
[07:50:37] * Bot sets mode: -bbbbbb *!*@ServerNet-2j0.486.14.37.IP *!*@ServerNet-0u6.010.74.63.IP *!*@ServerNet-739.155.90.66.IP *!*@ServerNet-956.593.88.84.IP *!*@ServerNet-r89.545.76.68.IP *!*@ServerNet-295.092.61.00.IP
[07:50:40] * Bot sets mode: -bbbbbb *!*@ServerNet-8j8.212.02.18.IP *!*@ServerNet-o42.086.68.66.IP *!*@ServerNet-am0.403.63.16.IP *!*@ServerNet-532.443.07.22.IP *!*@ServerNet-d90.320.18.31.IP *!*@ServerNet-2qg.395.54.78.IP

Maybe the server has a anti-flood function that prevents you to do mass modes? Have you tried removing all those bans by yourself?
_________________
I tawt I taw a puddy tat!
Back to top
View user's profile Send private message
simo
Master


Joined: 22 Mar 2015
Posts: 330

PostPosted: Thu Apr 23, 2015 5:37 am    Post subject: Reply with quote

i have an opered bot with all privliages and no limmitations on testnet wich has max of 15 mode settings in 1 line
Back to top
View user's profile Send private message
simo
Master


Joined: 22 Mar 2015
Posts: 330

PostPosted: Fri Apr 24, 2015 2:48 pm    Post subject: Reply with quote

i tried your version and it works nice
altho sometimes it doesnt remove all bans
i guess there is no way to guarantee that
tnx spike^^
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3584
Location: Mint Factory

PostPosted: Sat Apr 25, 2015 1:02 am    Post subject: Reply with quote

As expected, either code you've used makes no sense not to have them all removed and this means there's something on the server side that doesn't let the bot to remove all bans, or more than a certain amount. Count them when it doesn't remove them all and then try with slightly less and see if there's indeed a limit or something.
_________________
I tawt I taw a puddy tat!
Back to top
View user's profile Send private message
simo
Master


Joined: 22 Mar 2015
Posts: 330

PostPosted: Sat Apr 25, 2015 5:12 am    Post subject: Reply with quote

server side allows bot to set as much modes as it wants since its opered and limitless privliges so that cant be it

but its ok if theres any remaining ban left i ll remove manually

thnx again caesar
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Goto page Previous  1, 2, 3, 4  Next
Page 2 of 4

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber