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 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
Arnold_X-P
Op


Joined: 30 Oct 2006
Posts: 183
Location: DALnet - Trinidad - Beni - Bolivia

PostPosted: Sat Apr 18, 2015 4:32 pm    Post subject: clearbans it's not working Reply with quote

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"

_________________
Very Happy thanks to that they help, that others learn Very Happy
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1028

PostPosted: Sat Apr 18, 2015 5:21 pm    Post subject: Re: clearbans it's not working Reply with quote

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
View user's profile Send private message
SpiKe^^
Owner


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

PostPosted: Sat Apr 18, 2015 6:41 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1028

PostPosted: Sat Apr 18, 2015 11:02 pm    Post subject: Reply with quote

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
View user's profile Send private message
caesar
Mint Rubber


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

PostPosted: Sun Apr 19, 2015 5:43 am    Post subject: Reply with quote

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.
_________________
I tawt I taw a puddy tat!
Back to top
View user's profile Send private message
Arnold_X-P
Op


Joined: 30 Oct 2006
Posts: 183
Location: DALnet - Trinidad - Beni - Bolivia

PostPosted: Sun Apr 19, 2015 11:16 am    Post subject: Re: clearbans it's not working Reply with quote

thanks willyw SpiKe^^ (my bros) caesar
thank you very much Cool
_________________
Very Happy thanks to that they help, that others learn Very Happy
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Arnold_X-P
Op


Joined: 30 Oct 2006
Posts: 183
Location: DALnet - Trinidad - Beni - Bolivia

PostPosted: Sun Apr 19, 2015 11:40 am    Post subject: Re: clearbans it's not working Reply with quote

[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
_________________
Very Happy thanks to that they help, that others learn Very Happy
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1028

PostPosted: Sun Apr 19, 2015 12:10 pm    Post subject: Re: clearbans it's not working Reply with quote

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
View user's profile Send private message
Arnold_X-P
Op


Joined: 30 Oct 2006
Posts: 183
Location: DALnet - Trinidad - Beni - Bolivia

PostPosted: Sun Apr 19, 2015 6:19 pm    Post subject: Re: clearbans it's not working Reply with quote

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 Rolling Eyes
_________________
Very Happy thanks to that they help, that others learn Very Happy
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
SpiKe^^
Owner


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

PostPosted: Sun Apr 19, 2015 7:11 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Arnold_X-P
Op


Joined: 30 Oct 2006
Posts: 183
Location: DALnet - Trinidad - Beni - Bolivia

PostPosted: Sun Apr 19, 2015 7:33 pm    Post subject: clearbans it's not working - solved Reply with quote

thanks SpiKe^^ Very Happy
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
_________________
Very Happy thanks to that they help, that others learn Very Happy
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
caesar
Mint Rubber


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

PostPosted: Mon Apr 20, 2015 12:53 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
   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. Rolling Eyes

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.
_________________
I tawt I taw a puddy tat!
Back to top
View user's profile Send private message
Arnold_X-P
Op


Joined: 30 Oct 2006
Posts: 183
Location: DALnet - Trinidad - Beni - Bolivia

PostPosted: Mon Apr 20, 2015 7:14 pm    Post subject: Reply with quote

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.
_________________
Very Happy thanks to that they help, that others learn Very Happy
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
SpiKe^^
Owner


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

PostPosted: Mon Apr 20, 2015 9:06 pm    Post subject: Reply with quote

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
Arnold_X-P
Op


Joined: 30 Oct 2006
Posts: 183
Location: DALnet - Trinidad - Beni - Bolivia

PostPosted: Mon Apr 20, 2015 10:22 pm    Post subject: Reply with quote

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.
_________________
Very Happy thanks to that they help, that others learn Very Happy
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
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 1, 2, 3, 4  Next
Page 1 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