This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Restrictor.tcl not working

Old posts that have not been replied to for several years.
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Restrictor.tcl not working

Post by metroid »

Code: Select all

bind mode - "* +b" do_on_ban
proc do_on_ban {nick host hand chan mode vict} {
  global botnick protector
  if {![validuser $hand]} {
    if {[string tolower $nick] == [string tolower $botnick]} { return }
    if {![matchattr $hand o]} {
      puthelp "NOTICE $nick :$protector(reply)"
      pushmode $chan -o $nick
      newchanban $chan [maskhost [getchanhost $nick $chan]] $botnick $protector(reason) 1
      putserv "MODE $chan +b [maskhost [getchanhost $nick $chan]]"
      pushmode $chan -b [lindex $banlist [expr [llength [chanbans $chan]] -1]]
    }
  }
 }
This is the code, now the problem is, the bot doesn't unban people. Its because the person that made it (Papillon) didnt define banlist and i have no clue what to set banlist too then, I've send him an email but i have no clue if he's still active in the tcl stuff
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

What does this script do at first?
It binds on mode +b, so if a ban is set by a non-op (not an +o) then that person is deoped and banned by the bot?

Then why do you use putserv, when you have already used newchanban, strange :-?

Then after that what are you trying to unban? the ban placed?
I presume you can get that out of $vict if I am correct.

And replace this:

Code: Select all

if {[string tolower $nick] == [string tolower $botnick]} { return }
with:

Code: Select all

if {([string equal -nocase $botnick $nick])} { return 0 }
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

The script bans the person that sets an ban without permission, afterwards it has to unset the ban set by that person without permission.

Example:

* moo sets mode: +b blah!blah@moomoobot.com
* chanbot sets mode: -o+b moo moo!moo@mooshost.com
* moo was kicked by chanbot (Don't break the rules)
* chanbot sets mode: -b blah!blah@moomoobot.com

Thats what its supposed to do, but so far it only bans the person and then nothing happens cept for the error that it can't find the banlist variable.
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Code: Select all

pushmode -b [lindex $banlist [expr [llength [chanbans $chan]] -1]]
Basically what this code is trying todo is, that it is finding the last ban placed in the channels banlist and removing it.

It might not be working as there maybe a difference with the IRCd and also because $banlist is not defined.

Try this:

Code: Select all

pushmode -b [lindex [expr [llength [chanbans $chan]] -1] 0]
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

nope, nothing happens :\
User avatar
YooHoo
Owner
Posts: 939
Joined: Thu Feb 13, 2003 10:07 pm
Location: Redwood Coast

Re: Restrictor.tcl not working

Post by YooHoo »

MeTroiD wrote:

Code: Select all

bind mode - "* +b" do_on_ban
...
putserv "MODE $chan +b [maskhost [getchanhost $nick $chan]]"
seems like there shouldn't be a space in your bind to me...

Code: Select all

bind mode - "*+b*" do_on_ban
Also seems like you wouldn't use putserve "MODE $chan +b..., but rather the pushmode command.

Code: Select all

pushmode $chan +b...
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

Yoohoo, The banning works just fine. Its the unbanning, read the post next time plz :|
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Re: Restrictor.tcl not working

Post by user »

awyeah wrote:

Code: Select all

pushmode -b [lindex [expr [llength [chanbans $chan]] -1] 0]
how about

Code: Select all

pushmode $chan -b $vict
:)
YooHoo wrote:
MeTroiD wrote:

Code: Select all

bind mode - "* +b" do_on_ban
...
putserv "MODE $chan +b [maskhost [getchanhost $nick $chan]]"
seems like there shouldn't be a space in your bind to me...

Code: Select all

bind mode - "*+b*" do_on_ban
The space in the bind is there for a reason. Your bind would match any mode on a channel with "+b" in its name :)
Have you ever read "The Manual"?
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

I've tried something else, and this works but i've seen it get errors sometimes :(

Code: Select all

bind mode -|-  "* +b" modes:saveban

proc modes:saveban {nick host hand chan mode vict} {
 global lastban
  if {($mode == "+b")} {
    set lastban($chan) $vict
  }
}

bind mode - "* +b" banprot
proc banprot {nick host hand chan mode vict} {
  global botnick protector lastban
if {![channel get $chan paranoid]} { 
return 
 } 
if {[channel get $chan enforce]} { 
return 
 } 
  if {![validuser $hand]} {
    if {[string tolower $nick] == [string tolower $botnick]} { return }
    if {![matchattr $hand o]} {
	putquick "MODE $chan -b $lastban($chan)"
	unset lastban($chan) 
      putquick "MODE $chan -o+b  $nick [maskhost [getchanhost $nick $chan]]"
	putquick "KICK $chan $nick :$protector(reason)"
    }
  }
 }
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

You can always do:

Code: Select all

putserv "MODE $chan -b $vict"
As 'user' said, it will unban the last placed ban when you bind on +b. Hopefully provided the modes are not +bb, +bbb or even more heh. (then there might be some adjustment required)
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

awyeah wrote:Hopefully provided the modes are not +bb, +bbb or even more heh. (then there might be some adjustment required)
tcl-commands.doc wrote:mode changes are broken down into their component parts before being sent here, so the <mode-change> will always be a single mode, such as "+m" or "-o".
Have you ever read "The Manual"?
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

Tried it but it doesnt work.
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Okay, here try this.
I've reduced most lines into one and shortened it. :wink:

Code: Select all

bind mode - "+*b*" ban:prot

proc ban:prot {nick uhost hand chan mode target} { 
  global botnick
if {(![channel get $chan paranoid]) || ([channel get $chan +enforce]) || ([string equal -nocase $botnick $nick]) || ([matchattr $hand o|o $chan])} { return 0 }
 if {([string match "*+b*" $mode]) && ($target != "")} {
   putquick "MODE $chan -o+b-b $nick [maskhost [getchanhost $nick $chan]] $target" -next
   putquick "KICK $chan $nick :Do not ban that address!" -next; return 0
   }
}
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

Wow, thanks that actually worked exactly like i wanted it to work :]
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Haha, okay actually I didn't change anything or do anything new if you look closer. :mrgreen:
All I did was grouped all your conditions into one which made it easier to read and to implement. :wink:

Next time use putlogs to see the outputs and check them.
E.g. putlog "Banmask: $target"
#To see the banmask banned by the user (in your case)
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
Locked