| View previous topic :: View next topic |
| Author |
Message |
Alchera Revered One

Joined: 11 Aug 2003 Posts: 3344 Location: Ballarat Victoria, Australia
|
Posted: Wed Sep 20, 2006 8:58 am Post subject: |
|
|
| i.m.offline wrote: | | sorry for bothering again, if I want to exempt Bot users from being kicked as well, how can I add it? Please suggest so I will give a try. Thx |
| Code: | matchattr <handle> <flags> [channel]
Returns: 1 if the specified user has the specified flags; 0 otherwise |
For a list of the user flags type the following in the party line:
_________________ Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM |
|
| Back to top |
|
 |
i.m.offline Halfop
Joined: 02 Mar 2006 Posts: 74
|
Posted: Sat Sep 23, 2006 7:21 am Post subject: |
|
|
is it something like
if {[matchattr $hand o]} { return 1 }
where do I have to add this line, tried adding some places but couldn't make it work :/ |
|
| Back to top |
|
 |
r0t3n Owner
Joined: 31 May 2005 Posts: 507 Location: UK
|
Posted: Sat Sep 23, 2006 10:37 am Post subject: |
|
|
| Code: | bind mode - "* +b" enforcebans
set enforce(max) "8"
set enforce(kmsg) "Banned :ban: by :nick:"
proc enforcebans {nick uhost hand chan mc ban} {
global enforce botname
if {![botisop $chan]} { return }
set ban [string map {"\\" "\\\\" "\[" "\\["} $ban]
if {[string match -nocase $ban $botname]} { return }
set kickmsg "$enforce(kmsg)"
regsub -all :ban: $kickmsg $ban kickmsg
regsub -all :nick: $kickmsg $nick kickmsg
set list ""
foreach user [chanlist $chan] {
if {[matchattr [nick2hand $user] f|f $chan]} { return }
if {[string match -nocase $ban $user![getchanhost $user $chan]]} {
lappend list $user
}
}
if {[llength $list] == "0"} { return }
if {[llength $list] > $enforce(max)} {
putserv "MODE $chan -ob $nick $ban"
} else {
if {[llength $list] <= "3"} {
putserv "KICK $chan [join $list ,] :$kickmsg"
} else {
set nlist ""
foreach x $list {
lappend nlist $x
if {[llength $nlist] == "3"} {
putserv "KICK $chan [join $nlist ,] :$kickmsg"
set nlist ""
}
}
if {[llength $nlist] != ""} {
putserv "KICK $chan [join $nlist ,] :$kickmsg"
set nlist ""
}
}
}
}
putlog "Enforcebans loaded." |
It will excempt bot users with the global and channel flag +f (friend flag). _________________ r0t3n @ #r0t3n @ Quakenet |
|
| Back to top |
|
 |
i.m.offline Halfop
Joined: 02 Mar 2006 Posts: 74
|
Posted: Sat Sep 23, 2006 11:09 am Post subject: |
|
|
| thanks for the help mate, but for some od reason, it doesn't kick at all nor it removes ban mask from flagged users :s despite of user being flagged or not. |
|
| Back to top |
|
 |
i.m.offline Halfop
Joined: 02 Mar 2006 Posts: 74
|
Posted: Wed Sep 27, 2006 8:59 am Post subject: |
|
|
| i have tried making few changes but still couldn't make it work. please help :/ thx |
|
| Back to top |
|
 |
honeybee Halfop
Joined: 01 Jan 2006 Posts: 80
|
Posted: Wed Sep 27, 2006 7:29 pm Post subject: |
|
|
| Code: | bind mode - "* +b" enforcebans
set enforce(max) "8"
proc enforcebans {nick uhost hand chan mc ban} {
global enforce botname
if {![botisop $chan]} { return }
set ban [string map {"\\" "\\\\" "\[" "\\["} $ban]
if {[string match -nocase $ban $botname]} { return }
set list ""
foreach user [chanlist $chan] {
if {[matchattr [nick2hand $user] f|f $chan]} { return }
if {[string match -nocase $ban $user![getchanhost $user $chan]]} {
lappend list $user
}
}
if {[llength $list] == "0"} { return }
if {[llength $list] > $enforce(max)} {
putserv "MODE $chan -ob $nick $ban"
}
}
}
putlog "Enforcebans loaded." |
So this can only be used to check if a banned host is banning more than 8 users and what if i also wana check if its banning *!*@* so i can do it more quick, thanks if this code can be more better. |
|
| Back to top |
|
 |
i.m.offline Halfop
Joined: 02 Mar 2006 Posts: 74
|
Posted: Thu Sep 28, 2006 2:31 am Post subject: |
|
|
when I tried using this code the bot quits giving error msg
invalid command name "}"
while executing
"}"
(file "scripts/enforcebans.tcl" line 22)
invoked from within
ya it should prvent *!*@* banmask too. thx in advance. |
|
| Back to top |
|
 |
krimson Halfop

Joined: 19 Apr 2006 Posts: 86
|
Posted: Thu Sep 28, 2006 3:41 am Post subject: |
|
|
| you have an extra closing bracket at the end of the script.. remove that and try again |
|
| Back to top |
|
 |
i.m.offline Halfop
Joined: 02 Mar 2006 Posts: 74
|
Posted: Thu Sep 28, 2006 4:31 am Post subject: |
|
|
thx for the suggestion krimson
I did give try for that earlier. Bot doesn't react at all for this code. it doesn't kick at all for whatsoever mask it is. |
|
| Back to top |
|
 |
r0t3n Owner
Joined: 31 May 2005 Posts: 507 Location: UK
|
Posted: Thu Sep 28, 2006 6:11 am Post subject: |
|
|
Try This:
| Code: | bind mode - "* +b" enforcebans
set enforce(max) "8"
set enforce(kmsg) "Banned :ban: by :nick:"
proc enforcebans {nick uhost hand chan mc ban} {
global enforce botname
if {![botisop $chan]} { return }
set ban [string map {"\\" "\\\\" "\[" "\\["} $ban]
if {[string match -nocase $ban $botname]} { return }
set kickmsg "$enforce(kmsg)"
regsub -all :ban: $kickmsg $ban kickmsg
regsub -all :nick: $kickmsg $nick kickmsg
set list ""
set continue "1"
foreach user [chanlist $chan] {
if {[matchattr [nick2hand $user] f|f $chan]} {
putserv "MODE $chan -b $ban"
putserv "NOTICE $nick :Ban removed with the reason: Matched a botusers hostmask."
set continue "0"
break
if {[string match -nocase $ban $user![getchanhost $user $chan]]} {
lappend list $user
}
}
if {$continue} {
if {[llength $list] == "0"} { return }
if {[llength $list] > $enforce(max)} {
putserv "MODE $chan -ob $nick $ban"
putserv "NOTICE $nick :Ban removed with the reason: Exceeded the max of $enforce(max) bans."
} else {
if {[llength $list] <= "3"} {
putserv "KICK $chan [join $list ,] :$kickmsg"
} else {
set nlist ""
foreach x $list {
lappend nlist $x
if {[llength $nlist] == "3"} {
putserv "KICK $chan [join $nlist ,] :$kickmsg"
set nlist ""
}
}
if {[llength $nlist] != ""} {
putserv "KICK $chan [join $nlist ,] :$kickmsg"
set nlist ""
}
}
}
}
}
putlog "Enforcebans loaded." |
_________________ r0t3n @ #r0t3n @ Quakenet |
|
| Back to top |
|
 |
i.m.offline Halfop
Joined: 02 Mar 2006 Posts: 74
|
Posted: Thu Sep 28, 2006 8:05 am Post subject: |
|
|
bot quit with error
| Code: |
[08:04] missing close-brace
while executing
"proc enforcebans {nick uhost hand chan mc ban} {
global enforce botname
if {![botisop $chan]} { return }
set ban [string map {"\\" "\\\\" "\[" "..."
(file "scripts/enforcebans.tcl" line 6) |
:/ thx for trying mate n sparing time for me |
|
| Back to top |
|
 |
r0t3n Owner
Joined: 31 May 2005 Posts: 507 Location: UK
|
Posted: Thu Sep 28, 2006 9:01 am Post subject: |
|
|
This code should work:
| Code: | bind mode - "* +b" enforcebans
set enforce(max) "8"
set enforce(kmsg) "Banned :ban: by :nick:"
proc enforcebans {nick uhost hand chan mc ban} {
global enforce botname
if {![botisop $chan]} { return }
set ban [string map {"\\" "\\\\" "\[" "\\["} $ban]
if {[string match -nocase $ban $botname]} { return }
set kickmsg "$enforce(kmsg)"
regsub -all :ban: $kickmsg $ban kickmsg
regsub -all :nick: $kickmsg $nick kickmsg
set list ""
set continue "1"
foreach user [chanlist $chan] {
if {[matchattr [nick2hand $user] f|f $chan]} {
putserv "MODE $chan -b $ban"
putserv "NOTICE $nick :Ban removed with the reason: Matched a botusers hostmask."
set continue "0"
break
} elseif {[string match -nocase $ban $user![getchanhost $user $chan]]} {
lappend list $user
}
}
if {$continue} {
if {[llength $list] == "0"} { return }
if {[llength $list] > $enforce(max)} {
putserv "MODE $chan -ob $nick $ban"
putserv "NOTICE $nick :Ban removed with the reason: Exceeded the max of $enforce(max) bans."
} else {
if {[llength $list] <= "3"} {
putserv "KICK $chan [join $list ,] :$kickmsg"
} else {
set nlist ""
foreach x $list {
lappend nlist $x
if {[llength $nlist] == "3"} {
putserv "KICK $chan [join $nlist ,] :$kickmsg"
set nlist ""
}
}
if {[llength $nlist] != ""} {
putserv "KICK $chan [join $nlist ,] :$kickmsg"
set nlist ""
}
}
}
}
}
putlog "Enforcebans loaded." |
_________________ r0t3n @ #r0t3n @ Quakenet |
|
| Back to top |
|
 |
i.m.offline Halfop
Joined: 02 Mar 2006 Posts: 74
|
Posted: Thu Sep 28, 2006 1:32 pm Post subject: |
|
|
now its releasing all the bans set by anyone  |
|
| Back to top |
|
 |
r0t3n Owner
Joined: 31 May 2005 Posts: 507 Location: UK
|
Posted: Fri Sep 29, 2006 6:50 am Post subject: |
|
|
Ok, this should be the last one now:
| Code: | bind mode - "* +b" enforcebans
set enforce(max) "8"
set enforce(kmsg) "Banned :ban: by :nick:"
proc enforcebans {nick uhost hand chan mc ban} {
global enforce botname
if {![botisop $chan]} { return }
set ban [string map {"\\" "\\\\" "\[" "\\["} $ban]
if {[string match -nocase $ban $botname]} { return }
set kickmsg "$enforce(kmsg)"
regsub -all :ban: $kickmsg $ban kickmsg
regsub -all :nick: $kickmsg $nick kickmsg
set list ""
set continue "1"
foreach user [chanlist $chan] {
if {![string match -nocase $nick $user] && [matchattr [nick2hand $user] f|f $chan] && ![isbotnick $user]} {
putserv "MODE $chan -b $ban"
putserv "NOTICE $nick :Ban removed with the reason: Matched a botusers hostmask."
set continue "0"
break
} elseif {[string match -nocase $ban $user![getchanhost $user $chan]]} {
lappend list $user
}
}
if {$continue} {
if {[llength $list] == "0"} { return }
if {[llength $list] > $enforce(max)} {
putserv "MODE $chan -ob $nick $ban"
putserv "NOTICE $nick :Ban removed with the reason: Exceeded the max of $enforce(max) bans."
} else {
if {[llength $list] <= "3"} {
putserv "KICK $chan [join $list ,] :$kickmsg"
} else {
set nlist ""
foreach x $list {
lappend nlist $x
if {[llength $nlist] == "3"} {
putserv "KICK $chan [join $nlist ,] :$kickmsg"
set nlist ""
}
}
if {[llength $nlist] != ""} {
putserv "KICK $chan [join $nlist ,] :$kickmsg"
set nlist ""
}
}
}
}
}
putlog "Enforcebans loaded." |
_________________ r0t3n @ #r0t3n @ Quakenet |
|
| Back to top |
|
 |
metroid Owner
Joined: 16 Jun 2004 Posts: 771
|
Posted: Fri Sep 29, 2006 5:28 pm Post subject: |
|
|
| Code: | bind mode - "* +b" enforcebans
set enforce(max) "8"
set enforce(kmsg) "Banned :ban: by :nick:"
proc enforcebans {nick uhost hand chan mc ban} {
global enforce botname
if {[botisop $chan]} {
set ban [string map {"\\" "\\\\" "\[" "\\["} $ban]
if {[string match $ban $botname]} {
return 0
}
set reason [string map [list ":ban:" "$ban" ":nick" "$nick"] $enforce(kmsg)
set list [list]
set continue 1
foreach user [chanlist $chan] {
if {[isbotnick $user]} {
continue
} elseif {[matchattr [nick2hand $user] f|f $chan]} {
pushmode $chan -b $ban
set continue 0
break
} elseif {[string match -nocase $ban $user![getchanhost $user $chan]]} {
lappend list $user
}
}
if {$continue} {
if {[set llist [llength $list]]} {
if {$llist > $enforce(max)} {
putserv "MODE $chan -ob $nick $ban"
} else {
if {$llist <= 3} {
putserv "KICK $chan [join $list ,] :$reason"
} else {
for {set i 0;set temp [list];set j 0} {$i <= $llist} {incr i} {
if {$j == 3 || $i == $llist} {
if {$j > 0} {
putserv "KICK $chan [join $temp ,] :$reason"
set temp [list]
set j 0
if {$j == $llist} {
break
}
}
lappend temp [lindex $list $i]
incr j
}
}
}
}
}
}
}
} |
Should work fine. [untested] |
|
| Back to top |
|
 |
|