View previous topic :: View next topic |
Author |
Message |
simo Owner
Joined: 22 Mar 2015 Posts: 859
|
Posted: Thu Apr 08, 2021 10:04 am Post subject: |
|
|
tested it and it works flawlessly excellent work there spike^^ much apreciated once again |
|
Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 859
|
Posted: Mon Apr 12, 2021 8:16 pm Post subject: |
|
|
it would be even more complete if !ub !um is added to have it work on unban and unmute as well |
|
Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 771 Location: Tennessee, USA
|
Posted: Thu Apr 15, 2021 11:03 am Post subject: New commands !ub and !um |
|
|
See if these new commands are what you had in mind.
Extended the time to save hosts to 5 minutes.
Code: |
# max number of bans/devoice to stack in one mode command (1 or more) #
set pkb(maxban) 6
# max number of kicks to stack in one kick command (1 or more) #
set pkb(maxkick) 3
##############
bind pub -|- !k pub:kick
proc pub:kick {nk uh hn ch tx} { pub:kickban $nk $uh $hn $ch $tx k }
bind pub -|- !b pub:ban
proc pub:ban {nk uh hn ch tx} { pub:kickban $nk $uh $hn $ch $tx b }
bind pub -|- !m pub:muteban
proc pub:muteban {nk uh hn ch tx} { pub:kickban $nk $uh $hn $ch $tx m }
####
bind pub -|- !ub pub:unban
proc pub:unban {nk uh hn ch tx} { pub:kickban $nk $uh $hn $ch $tx ub }
bind pub -|- !um pub:unmute
proc pub:unmute {nk uh hn ch tx} { pub:kickban $nk $uh $hn $ch $tx um }
####
bind pub -|- !kb pub:kickban
proc pub:kickban {nk uh hn ch tx {do kb} } {
global pkb storehosts
if {![isop $nk $ch] && ![ishalfop $nk $ch] && ![matchattr $hn o|o $ch]} {
return 0
}
if {[string match u* $do]} {
set plus "-"
set nickls [split [string trim $tx]]
} else {
set plus "+"
set reason [join [lrange [split $tx "."] 1 end] "."]
if {$reason eq ""} { set reason "Please change your behaviour thank you." }
set nickls [split [string trim [lindex [split $tx "."] 0]]]
}
foreach nick $nickls {
if {[string match u* $do] && [string match *!*@* $nick]} {
set bmask $nick
if {[string match um $do] && ![string match ~q:* $bmask]} {
set bmask ~q:$bmask
}
if {[ischanban $bmask $ch]} { lappend bmasks $bmask
} else { putserv "NOTICE $nk :$bmask is not a current ban on $ch" }
continue
}
set aname [string tolower "$nick@$ch"]
if {[onchan $nick $ch]} {
if {![string match u* $do]} {
if {[isop $nick $ch] || [ishalfop $nick $ch]} { continue }
if {[matchattr [nick2hand $nick] o|o $ch]} { continue }
}
if {[string match {*[bm]} $do]} {
set chost [getchanhost $nick $ch]
set bmask [maskhost "$nick!$chost" 2]
if {[string match *m $do]} { set bmask ~q:$bmask }
if {[string match u* $do] && ![ischanban $bmask $ch]} {
putserv "NOTICE $nk :$bmask \[$nick\] is not a current ban on $ch"
continue
}
lappend bmasks $bmask
if {($do ne "kb") && ![string match u* $do] && [isvoice $nick $ch]} {
lappend dvnicks $nick
}
}
if {[string match k* $do]} { lappend knicks $nick }
} elseif {[info exists storehosts($aname)] && ($do ne "k")} {
if {![string match u* $do]} {
if {[matchattr [lindex $storehosts($aname) 2] o|o $ch]} { continue }
}
set chost [lindex $storehosts($aname) 0]
set bmask [maskhost "$nick!$chost" 2]
if {[string match *m $do]} { set bmask ~q:$bmask }
if {[string match u* $do] && ![ischanban $bmask $ch]} {
putserv "NOTICE $nk :$bmask \[$nick\] is not a current ban on $ch"
continue
}
lappend bmasks $bmask
} else { putserv "NOTICE $nk :$nick is not on channel $ch" }
}
if {[info exists dvnicks]} {
while {[set len [llength $dvnicks]] > 0} {
if {$len > $pkb(maxban)} {
set mode [string repeat "v" $pkb(maxban)]
set nicks [join [lrange $dvnicks 0 [expr {$pkb(maxban) - 1}]]]
set dvnicks [lrange $dvnicks $pkb(maxban) end]
} else {
set mode [string repeat "v" $len]
set nicks [join $dvnicks]
set dvnicks ""
}
putquick "MODE $ch -$mode $nicks"
}
}
if {[info exists bmasks]} {
while {[set len [llength $bmasks]] > 0} {
if {$len > $pkb(maxban)} {
set mode [string repeat "b" $pkb(maxban)]
set masks [join [lrange $bmasks 0 [expr {$pkb(maxban) - 1}]]]
set bmasks [lrange $bmasks $pkb(maxban) end]
} else {
set mode [string repeat "b" $len]
set masks [join $bmasks]
set bmasks ""
}
putquick "MODE $ch $plus$mode $masks"
}
}
if {[info exists knicks]} {
while {[set len [llength $knicks]] > 0} {
if {$len > $pkb(maxkick)} {
set nicks [join [lrange $knicks 0 [expr {$pkb(maxkick) - 1}]] ","]
set knicks [lrange $knicks $pkb(maxkick) end]
} else {
set nicks [join $knicks ","]
set knicks ""
}
putserv "KICK $ch $nicks :$reason"
}
}
}
####
bind part - * store:hosts
bind sign - * store:hosts
proc store:hosts {nk uh hn ch msg} {
set aname [string tolower $nk@$ch]
set ::storehosts($aname) [list $uh [expr {[unixtime]+300}] $hn]
}
bind time - * expire:hosts
proc expire:hosts {mn hr da mo yr} {
global storehosts
set ut [unixtime]
foreach {aname avalue} [array get storehosts] {
if {$ut >= [lindex $avalue 1]} { unset storehosts($aname) }
}
}
|
_________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Last edited by SpiKe^^ on Fri Apr 16, 2021 4:53 pm; edited 2 times in total |
|
Back to top |
|
 |
DasBrain Voice
Joined: 08 Apr 2021 Posts: 12
|
Posted: Thu Apr 15, 2021 11:44 am Post subject: |
|
|
By the way, there is also /whowas nick.  |
|
Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 859
|
Posted: Thu Apr 15, 2021 12:09 pm Post subject: |
|
|
Dasbrain the problem with that is if different ppl use the same name u end up with many IPS wich makes it hard to determine wich one to use when using /whowas |
|
Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 859
|
Posted: Fri Apr 16, 2021 10:59 am Post subject: |
|
|
tested again and it works as expected excellent thanks SpiKe^^ |
|
Back to top |
|
 |
Gulio Halfop
Joined: 01 Nov 2020 Posts: 73
|
Posted: Thu Apr 22, 2021 1:02 pm Post subject: Hello |
|
|
is possible to set ban time for ban 5 min (300)
!b nick
and for kb and mute 1 hour (3600) and to be unban
!kb nick
!m nick
and to be the both trigger with !m !b !kb and with .m .b .kb
and !b /.b nick 10 ( to be set ban for 10 min , when default is 5 same and for kb and mute ) |
|
Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 771 Location: Tennessee, USA
|
Posted: Fri Apr 23, 2021 10:45 am Post subject: |
|
|
Gulio : Please test this out some.
Code: |
# max number of bans/devoice to stack in one mode command (1 or more) #
set pkb(maxban) 6
# max number of kicks to stack in one kick command (1 or more) #
set pkb(maxkick) 3
# set default ban/mute times (in minutes) #
# 0 = this script doesn't remove bans/mutes #
set pkb(kb_bantime) 60
set pkb(b_bantime) 5
set pkb(m_mutetime) 60
# set mask type for bans and mutes #
# https://docs.eggheads.org/mainDocs/tcl-commands.html#maskhost-nick-user-host-masktype #
set pkb(ban_masktype) 1
set pkb(mute_masktype) 1
set pkb(mute_maskpre) "~q:"
##############
bind pub -|- !k pub:kick
bind pub -|- .k pub:kick
proc pub:kick {nk uh hn ch tx} { pub:kickban $nk $uh $hn $ch $tx k }
bind pub -|- !b pub:ban
bind pub -|- .b pub:ban
proc pub:ban {nk uh hn ch tx} { pub:kickban $nk $uh $hn $ch $tx b }
bind pub -|- !m pub:muteban
bind pub -|- .m pub:muteban
proc pub:muteban {nk uh hn ch tx} { pub:kickban $nk $uh $hn $ch $tx m }
bind pub -|- !ub pub:unban
bind pub -|- .ub pub:unban
proc pub:unban {nk uh hn ch tx} { pub:kickban $nk $uh $hn $ch $tx ub }
bind pub -|- !um pub:unmute
bind pub -|- .um pub:unmute
proc pub:unmute {nk uh hn ch tx} { pub:kickban $nk $uh $hn $ch $tx um }
bind pub -|- !kb pub:kickban
bind pub -|- .kb pub:kickban
proc pub:kickban {nk uh hn ch tx {do kb} } {
global pkb storehosts
if {$uh ne "Timer"} {
if {![isop $nk $ch] && ![ishalfop $nk $ch] && ![matchattr $hn o|o $ch]} {
return 0
}
}
if {[string match u* $do]} {
set plus "-"
set nickls [split [string trim $tx]]
} else {
set plus "+"
set reason [join [lrange [split $tx "."] 1 end] "."]
if {$reason eq ""} { set reason "Please change your behaviour thank you." }
set nickls [split [string trim [lindex [split $tx "."] 0]]]
}
set seconds 0
if {[string is digit [lindex $nickls end]]} {
if {[string match {[bm]} $do] || ($do eq "kb")} {
set seconds [expr {[lindex $nickls end] * 60}]
}
set nickls [lrange $nickls 0 end-1]
} elseif {$do eq "m"} { set seconds [expr {$pkb(m_mutetime) * 60}]
} elseif {$do eq "b"} { set seconds [expr {$pkb(b_bantime) * 60}]
} elseif {$do eq "kb"} { set seconds [expr {$pkb(kb_bantime) * 60}] }
set masktype $pkb(ban_masktype)
if {[string match *m $do]} { set masktype $pkb(mute_masktype) }
foreach nick $nickls {
if {$nick eq ""} { continue }
if {[string match u* $do] && [string match *!*@* $nick]} {
set bmask $nick
if {($do eq "um") && ![string match $pkb(mute_maskpre)* $bmask]} {
set bmask $pkb(mute_maskpre)$bmask
}
if {[ischanban $bmask $ch]} { lappend bmasks $bmask
} elseif {$uh ne "Timer"} {
putserv "NOTICE $nk :$bmask is not a current ban on $ch"
}
continue
}
set aname [string tolower "$nick@$ch"]
if {[onchan $nick $ch]} {
if {![string match u* $do]} {
if {[isop $nick $ch] || [ishalfop $nick $ch]} { continue }
if {[matchattr [nick2hand $nick] o|o $ch]} { continue }
}
if {[string match {*[bm]} $do]} {
set chost [getchanhost $nick $ch]
set bmask [maskhost "$nick!$chost" $masktype]
if {[string match *m $do]} { set bmask $pkb(mute_maskpre)$bmask }
if {[string match u* $do] && ![ischanban $bmask $ch]} {
putserv "NOTICE $nk :$bmask \[$nick\] is not a current ban on $ch"
continue
}
lappend bmasks $bmask
if {($do ne "kb") && ![string match u* $do] && [isvoice $nick $ch]} {
lappend dvnicks $nick
}
}
if {[string match k* $do]} { lappend knicks $nick }
} elseif {[info exists storehosts($aname)] && ($do ne "k")} {
if {![string match u* $do]} {
if {[matchattr [lindex $storehosts($aname) 2] o|o $ch]} { continue }
}
set chost [lindex $storehosts($aname) 0]
set bmask [maskhost "$nick!$chost" $masktype]
if {[string match *m $do]} { set bmask $pkb(mute_maskpre)$bmask }
if {[string match u* $do] && ![ischanban $bmask $ch]} {
putserv "NOTICE $nk :$bmask \[$nick\] is not a current ban on $ch"
continue
}
lappend bmasks $bmask
} else { putserv "NOTICE $nk :$nick is not on channel $ch" }
}
if {[info exists dvnicks]} {
while {[set len [llength $dvnicks]] > 0} {
if {$len > $pkb(maxban)} {
set mode [string repeat "v" $pkb(maxban)]
set nicks [join [lrange $dvnicks 0 [expr {$pkb(maxban) - 1}]]]
set dvnicks [lrange $dvnicks $pkb(maxban) end]
} else {
set mode [string repeat "v" $len]
set nicks [join $dvnicks]
set dvnicks ""
}
putquick "MODE $ch -$mode $nicks"
}
}
if {[info exists bmasks]} {
if {$seconds > 0} {
utimer $seconds [list pub:kickban $nk Timer $hn $ch [join $bmasks] ub]
}
while {[set len [llength $bmasks]] > 0} {
if {$len > $pkb(maxban)} {
set mode [string repeat "b" $pkb(maxban)]
set masks [join [lrange $bmasks 0 [expr {$pkb(maxban) - 1}]]]
set bmasks [lrange $bmasks $pkb(maxban) end]
} else {
set mode [string repeat "b" $len]
set masks [join $bmasks]
set bmasks ""
}
putquick "MODE $ch $plus$mode $masks"
}
}
if {[info exists knicks]} {
while {[set len [llength $knicks]] > 0} {
if {$len > $pkb(maxkick)} {
set nicks [join [lrange $knicks 0 [expr {$pkb(maxkick) - 1}]] ","]
set knicks [lrange $knicks $pkb(maxkick) end]
} else {
set nicks [join $knicks ","]
set knicks ""
}
putserv "KICK $ch $nicks :$reason"
}
}
}
####
bind part - * store:hosts
bind sign - * store:hosts
proc store:hosts {nk uh hn ch msg} {
set aname [string tolower $nk@$ch]
set ::storehosts($aname) [list $uh [expr {[unixtime]+600}] $hn]
}
bind time - * expire:hosts
proc expire:hosts {mn hr da mo yr} {
global storehosts
set ut [unixtime]
foreach {aname avalue} [array get storehosts] {
if {$ut >= [lindex $avalue 1]} { unset storehosts($aname) }
}
}
|
_________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
Back to top |
|
 |
Gulio Halfop
Joined: 01 Nov 2020 Posts: 73
|
Posted: Fri Apr 23, 2021 1:59 pm Post subject: hello |
|
|
Spike^^ now is work good excellent great work thx
if u have time to set 1 more option
when is find hostmask *.irccloud.com || *.mibbit.com
to set ban on ident of cloud *!uid123457@* and for mibbit *!ba1r34d@*
this to be added on proc ban and mute
thx again in advance
Code: |
* Joins: John (uid479754@Test-DA54ABD8.irccloud.com)
[20:45:31] <@Nick> .b Cathe Mary John 1
[20:45:32] * BOT sets mode: +bbb *!*@48D59C09.BFD0590A.37B03A79.IP *!*@96C6E1DE.ABD124CC.73152542.IP *!*@Test-DA54ABD8.irccloud.com
to set ban this way for ircloud iden
+bbb *!*@48D59C09.BFD0590A.37B03A79.IP *!*@96C6E1DE.ABD124CC.73152542.IP *!uid479754@*
|
this code to be same for ban and mute proc
Code: |
if {[set chost [getchanhost $user $chan]] ne ""} {
switch -glob -- $chost {
{*.irccloud.com} - {*.mibbit.com} - {*.kiwiirc.com} - {*.8C39393E.IP} {
set mask *![lindex [split $chost @] 0]@*
}
{default} {
set mask [maskhost "$user!$chost" 2]
}
|
|
|
Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 771 Location: Tennessee, USA
|
Posted: Sat Apr 24, 2021 10:59 am Post subject: |
|
|
Try this version with the protected hosts deal...
Code: |
# max number of bans/devoice to stack in one mode command (1 or more) #
set pkb(maxban) 6
# max number of kicks to stack in one kick command (1 or more) #
set pkb(maxkick) 3
# set default ban/mute times (in minutes) #
# 0 = this script doesn't remove bans/mutes #
set pkb(kb_bantime) 60
set pkb(b_bantime) 5
set pkb(m_mutetime) 60
# set mask type for bans and mutes #
# https://docs.eggheads.org/mainDocs/tcl-commands.html#maskhost-nick-user-host-masktype #
set pkb(ban_masktype) 2
set pkb(mute_masktype) 4
set pkb(mute_maskpre) "~q:"
# protected hosts #
# set only username bans on these domains (ex. *!uid123457@*) #
set pkb(phosts) "*.irccloud.com *.mibbit.com *.kiwiirc.com *.8C39393E.IP"
##############
bind pub -|- !k pub:kick
bind pub -|- .k pub:kick
proc pub:kick {nk uh hn ch tx} { pub:kickban $nk $uh $hn $ch $tx k }
bind pub -|- !b pub:ban
bind pub -|- .b pub:ban
proc pub:ban {nk uh hn ch tx} { pub:kickban $nk $uh $hn $ch $tx b }
bind pub -|- !m pub:muteban
bind pub -|- .m pub:muteban
proc pub:muteban {nk uh hn ch tx} { pub:kickban $nk $uh $hn $ch $tx m }
bind pub -|- !ub pub:unban
bind pub -|- .ub pub:unban
proc pub:unban {nk uh hn ch tx} { pub:kickban $nk $uh $hn $ch $tx ub }
bind pub -|- !um pub:unmute
bind pub -|- .um pub:unmute
proc pub:unmute {nk uh hn ch tx} { pub:kickban $nk $uh $hn $ch $tx um }
bind pub -|- !kb pub:kickban
bind pub -|- .kb pub:kickban
proc pub:kickban {nk uh hn ch tx {do kb} } {
global pkb storehosts
if {$uh ne "Timer"} {
if {![isop $nk $ch] && ![ishalfop $nk $ch] && ![matchattr $hn o|o $ch]} {
return 0
}
}
if {[string match u* $do]} {
set plus "-"
set nickls [split [string trim $tx]]
} else {
set plus "+"
set reason [join [lrange [split $tx "."] 1 end] "."]
if {$reason eq ""} { set reason "Please change your behaviour thank you." }
set nickls [split [string trim [lindex [split $tx "."] 0]]]
}
set seconds 0
if {[string is digit [lindex $nickls end]]} {
if {[string match {[bm]} $do] || ($do eq "kb")} {
set seconds [expr {[lindex $nickls end] * 60}]
}
set nickls [lrange $nickls 0 end-1]
} elseif {$do eq "m"} { set seconds [expr {$pkb(m_mutetime) * 60}]
} elseif {$do eq "b"} { set seconds [expr {$pkb(b_bantime) * 60}]
} elseif {$do eq "kb"} { set seconds [expr {$pkb(kb_bantime) * 60}] }
set masktype $pkb(ban_masktype)
if {[string match *m $do]} { set masktype $pkb(mute_masktype) }
foreach nick $nickls {
if {$nick eq ""} { continue }
if {[string match u* $do] && [string match *!*@* $nick]} {
set bmask $nick
if {($do eq "um") && ![string match $pkb(mute_maskpre)* $bmask]} {
set bmask $pkb(mute_maskpre)$bmask
}
if {[ischanban $bmask $ch]} { lappend bmasks $bmask
} elseif {$uh ne "Timer"} {
putserv "NOTICE $nk :$bmask is not a current ban on $ch"
}
continue
}
set aname [string tolower "$nick@$ch"]
if {[onchan $nick $ch]} {
set hand [nick2hand $nick]
if {![string match u* $do]} {
if {[isop $nick $ch] || [ishalfop $nick $ch]} { continue }
if {[matchattr $hand o|o $ch]} { continue }
}
set chost [getchanhost $nick $ch]
if {[string match {*[bm]} $do]} {
set bmask [mask:host $nick $chost $masktype $do]
if {[string match u* $do] && ![ischanban $bmask $ch]} {
putserv "NOTICE $nk :$bmask \[$nick\] is not a current ban on $ch"
continue
}
lappend bmasks $bmask
if {($do ne "kb") && ![string match u* $do] && [isvoice $nick $ch]} {
lappend dvnicks $nick
}
}
if {[string match k* $do]} { lappend knicks $nick
store:hosts $nick $chost $hand $ch pkb.tcl
}
} elseif {[info exists storehosts($aname)] && ($do ne "k")} {
if {![string match u* $do]} {
if {[matchattr [lindex $storehosts($aname) 2] o|o $ch]} { continue }
}
set chost [lindex $storehosts($aname) 0]
set bmask [mask:host $nick $chost $masktype $do]
if {[string match u* $do] && ![ischanban $bmask $ch]} {
putserv "NOTICE $nk :$bmask \[$nick\] is not a current ban on $ch"
continue
}
lappend bmasks $bmask
} else { putserv "NOTICE $nk :$nick is not on channel $ch" }
}
if {[info exists dvnicks]} {
while {[set len [llength $dvnicks]] > 0} {
if {$len > $pkb(maxban)} {
set mode [string repeat "v" $pkb(maxban)]
set nicks [join [lrange $dvnicks 0 [expr {$pkb(maxban) - 1}]]]
set dvnicks [lrange $dvnicks $pkb(maxban) end]
} else {
set mode [string repeat "v" $len]
set nicks [join $dvnicks]
set dvnicks ""
}
putquick "MODE $ch -$mode $nicks"
}
}
if {[info exists bmasks]} {
if {$seconds > 0} {
utimer $seconds [list pub:kickban $nk Timer $hn $ch [join $bmasks] ub]
}
while {[set len [llength $bmasks]] > 0} {
if {$len > $pkb(maxban)} {
set mode [string repeat "b" $pkb(maxban)]
set masks [join [lrange $bmasks 0 [expr {$pkb(maxban) - 1}]]]
set bmasks [lrange $bmasks $pkb(maxban) end]
} else {
set mode [string repeat "b" $len]
set masks [join $bmasks]
set bmasks ""
}
putquick "MODE $ch $plus$mode $masks"
}
}
if {[info exists knicks]} {
while {[set len [llength $knicks]] > 0} {
if {$len > $pkb(maxkick)} {
set nicks [join [lrange $knicks 0 [expr {$pkb(maxkick) - 1}]] ","]
set knicks [lrange $knicks $pkb(maxkick) end]
} else {
set nicks [join $knicks ","]
set knicks ""
}
putserv "KICK $ch $nicks :$reason"
}
}
}
#### protected hosts code
set pkb(phosts) [split [string trim $pkb(phosts)]]
proc mask:host {nick chost masktype do} {
set bmask [maskhost "$nick!$chost" $masktype]
foreach phost $::pkb(phosts) {
if {[string match -nocase $phost $chost]} {
set bmask "*![lindex [split $chost @] 0]@*"
break
}
}
if {[string match *m $do]} { set bmask $::pkb(mute_maskpre)$bmask }
return $bmask
}
#### stored nicks & uhosts code
bind part - * store:hosts
bind sign - * store:hosts
proc store:hosts {nk uh hn ch msg} {
set aname [string tolower $nk@$ch]
set ::storehosts($aname) [list $uh [expr {[unixtime]+900}] $hn]
}
bind time - * expire:hosts
proc expire:hosts {mn hr da mo yr} {
global storehosts
set ut [unixtime]
foreach {aname avalue} [array get storehosts] {
if {$ut >= [lindex $avalue 1]} { unset storehosts($aname) }
}
}
|
_________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Last edited by SpiKe^^ on Sun Apr 25, 2021 7:38 pm; edited 1 time in total |
|
Back to top |
|
 |
Gulio Halfop
Joined: 01 Nov 2020 Posts: 73
|
Posted: Sat Apr 24, 2021 11:59 am Post subject: Hello |
|
|
Spike^^ congratulation excellent work
i tested all option ban mute kick kb and is work great as i wanted it
thx a lot |
|
Back to top |
|
 |
Gulio Halfop
Joined: 01 Nov 2020 Posts: 73
|
Posted: Sun Jun 20, 2021 7:54 pm Post subject: Hello |
|
|
is possible to add and 1 options here in this script save host
set chtarget "#Test"
set chadmin "#Opers"
from channel #opers to use those triger command for main chan #Test same command how is for main channel so the staf can kick and ban and from #opers and this command to be used only from staf who stay in chan #opers
will be very usefull and helpfull , thx in advance
Code: |
set pkb(chtarget) "#Test2"
set pkb(chadmin) "#Test3"
# max number of bans/devoice to stack in one mode command (1 or more) #
set pkb(maxban) 6
# max number of kicks to stack in one kick command (1 or more) #
set pkb(maxkick) 3
# set default ban/mute times (in minutes) #
# 0 = this script doesn't remove bans/mutes #
set pkb(kb_bantime) 60
set pkb(b_bantime) 5
set pkb(m_mutetime) 60
# set mask type for bans and mutes #
# https://docs.eggheads.org/mainDocs/tcl-commands.html#maskhost-nick-user-host-masktype #
set pkb(ban_masktype) 2
set pkb(mute_masktype) 4
set pkb(mute_maskpre) "~q:"
# protected hosts #
# set only username bans on these domains (ex. *!uid123457@*) #
set pkb(phosts) "*.irccloud.com *.mibbit.com *.kiwiirc.com *.8C39393E.IP"
##############
bind pub -|- !k pub:kick
bind pub -|- .k pub:kick
proc pub:kick {nk uh hn ch tx} { pub:kickban $nk $uh $hn $ch $tx k }
bind pub -|- !b pub:ban
bind pub -|- .b pub:ban
proc pub:ban {nk uh hn ch tx} { pub:kickban $nk $uh $hn $ch $tx b }
bind pub -|- !m pub:muteban
bind pub -|- .m pub:muteban
proc pub:muteban {nk uh hn ch tx} { pub:kickban $nk $uh $hn $ch $tx m }
bind pub -|- !ub pub:unban
bind pub -|- .ub pub:unban
proc pub:unban {nk uh hn ch tx} { pub:kickban $nk $uh $hn $ch $tx ub }
bind pub -|- !um pub:unmute
bind pub -|- .um pub:unmute
proc pub:unmute {nk uh hn ch tx} { pub:kickban $nk $uh $hn $ch $tx um }
bind pub -|- !kb pub:kickban
bind pub -|- .kb pub:kickban
proc pub:kickban {nk uh hn ch tx {do kb} } {
global pkb storehosts
set ch [string tolower $ch]
if {$ch eq $pkb(chtarget) || $ch eq $pkb(chadmin) } {
if {![onchan $nk $pkb(chadmin)]} { return }
}
foreach user $tx {
if {![onchan $user $pkb(chtarget)]} {
putserv "NOTICE $nk $user is not on channel $pkb(chtarget)"
} elseif {[isop $user $pkb(chtarget)]} {
putserv "notice $nk :$user is op in $pkb(chtarget) "
} else {
if {[onchan $user $pkb(chadmin)]} {
putserv "NOTICE $nk $user is on channel $pkb(chadmin) dont ban him/her"
}
}
}
if {$uh ne "Timer"} {
if {![isop $nk $ch] && ![ishalfop $nk $ch] && ![matchattr $hn o|o $ch]} {
return 0
}
}
if {[string match u* $do]} {
set plus "-"
set nickls [split [string trim $tx]]
} else {
set plus "+"
set reason [join [lrange [split $tx "."] 1 end] "."]
if {$reason eq ""} { set reason "Please change your behaviour thank you." }
set nickls [split [string trim [lindex [split $tx "."] 0]]]
}
set seconds 0
if {[string is digit [lindex $nickls end]]} {
if {[string match {[bm]} $do] || ($do eq "kb")} {
set seconds [expr {[lindex $nickls end] * 60}]
}
set nickls [lrange $nickls 0 end-1]
} elseif {$do eq "m"} { set seconds [expr {$pkb(m_mutetime) * 60}]
} elseif {$do eq "b"} { set seconds [expr {$pkb(b_bantime) * 60}]
} elseif {$do eq "kb"} { set seconds [expr {$pkb(kb_bantime) * 60}] }
set masktype $pkb(ban_masktype)
if {[string match *m $do]} { set masktype $pkb(mute_masktype) }
foreach nick $nickls {
if {$nick eq ""} { continue }
if {[string match u* $do] && [string match *!*@* $nick]} {
set bmask $nick
if {($do eq "um") && ![string match $pkb(mute_maskpre)* $bmask]} {
set bmask $pkb(mute_maskpre)$bmask
}
if {[ischanban $bmask $ch]} { lappend bmasks $bmask
} elseif {$uh ne "Timer"} {
putserv "NOTICE $nk :$bmask is not a current ban on $ch"
}
continue
}
set aname [string tolower "$nick@$ch"]
if {[onchan $nick $ch]} {
set hand [nick2hand $nick]
if {![string match u* $do]} {
if {[isop $nick $ch] || [ishalfop $nick $ch]} { continue }
if {[matchattr $hand o|o $ch]} { continue }
}
set chost [getchanhost $nick $ch]
if {[string match {*[bm]} $do]} {
set bmask [mask:host $nick $chost $masktype $do]
if {[string match u* $do] && ![ischanban $bmask $ch]} {
putserv "NOTICE $nk :$bmask \[$nick\] is not a current ban on $ch"
continue
}
lappend bmasks $bmask
if {($do ne "kb") && ![string match u* $do] && [isvoice $nick $ch]} {
lappend dvnicks $nick
}
}
if {[string match k* $do]} { lappend knicks $nick
store:hosts $nick $chost $hand $ch pkb.tcl
}
} elseif {[info exists storehosts($aname)] && ($do ne "k")} {
if {![string match u* $do]} {
if {[matchattr [lindex $storehosts($aname) 2] o|o $ch]} { continue }
}
set chost [lindex $storehosts($aname) 0]
set bmask [mask:host $nick $chost $masktype $do]
if {[string match u* $do] && ![ischanban $bmask $ch]} {
putserv "NOTICE $nk :$bmask \[$nick\] is not a current ban on $ch"
continue
}
lappend bmasks $bmask
} else { putserv "NOTICE $nk :$nick is not on channel $ch" }
}
if {[info exists dvnicks]} {
while {[set len [llength $dvnicks]] > 0} {
if {$len > $pkb(maxban)} {
set mode [string repeat "v" $pkb(maxban)]
set nicks [join [lrange $dvnicks 0 [expr {$pkb(maxban) - 1}]]]
set dvnicks [lrange $dvnicks $pkb(maxban) end]
} else {
set mode [string repeat "v" $len]
set nicks [join $dvnicks]
set dvnicks ""
}
putquick "MODE $ch -$mode $nicks"
}
}
if {[info exists bmasks]} {
if {$seconds > 0} {
utimer $seconds [list pub:kickban $nk Timer $hn $ch [join $bmasks] ub]
}
while {[set len [llength $bmasks]] > 0} {
if {$len > $pkb(maxban)} {
set mode [string repeat "b" $pkb(maxban)]
set masks [join [lrange $bmasks 0 [expr {$pkb(maxban) - 1}]]]
set bmasks [lrange $bmasks $pkb(maxban) end]
} else {
set mode [string repeat "b" $len]
set masks [join $bmasks]
set bmasks ""
}
putquick "MODE $ch $plus$mode $masks"
}
}
if {[info exists knicks]} {
while {[set len [llength $knicks]] > 0} {
if {$len > $pkb(maxkick)} {
set nicks [join [lrange $knicks 0 [expr {$pkb(maxkick) - 1}]] ","]
set knicks [lrange $knicks $pkb(maxkick) end]
} else {
set nicks [join $knicks ","]
set knicks ""
}
putserv "KICK $ch $nicks :$reason"
}
}
}
#### protected hosts code
set pkb(phosts) [split [string trim $pkb(phosts)]]
proc mask:host {nick chost masktype do} {
set bmask [maskhost "$nick!$chost" $masktype]
foreach phost $::pkb(phosts) {
if {[string match -nocase $phost $chost]} {
set bmask "*![lindex [split $chost @] 0]@*"
break
}
}
if {[string match *m $do]} { set bmask $::pkb(mute_maskpre)$bmask }
return $bmask
}
#### stored nicks & uhosts code
bind part - * store:hosts
bind sign - * store:hosts
proc store:hosts {nk uh hn ch msg} {
set aname [string tolower $nk@$ch]
set ::storehosts($aname) [list $uh [expr {[unixtime]+900}] $hn]
}
bind time - * expire:hosts
proc expire:hosts {mn hr da mo yr} {
global storehosts
set ut [unixtime]
foreach {aname avalue} [array get storehosts] {
if {$ut >= [lindex $avalue 1]} { unset storehosts($aname) }
}
}
|
|
|
Back to top |
|
 |
Gulio Halfop
Joined: 01 Nov 2020 Posts: 73
|
Posted: Sun Jul 04, 2021 5:20 pm Post subject: hi |
|
|
I have another request for store info on kicks from other scripts or cs
like bind store kicks if is possible to be add , thx in advance |
|
Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 771 Location: Tennessee, USA
|
Posted: Mon Jul 05, 2021 4:03 pm Post subject: |
|
|
Gulio : This version should now save nick/host/handle info from every kick, from this script and all other sources...
Code: |
# pkb.tcl version 1.3 by SpiKe^^ (5July2021)
# max number of bans/devoice to stack in one mode command (1 or more) #
set pkb(maxban) 6
# max number of kicks to stack in one kick command (1 or more) #
set pkb(maxkick) 3
# set default ban/mute times (in minutes) #
# 0 = this script doesn't remove bans/mutes #
set pkb(kb_bantime) 60
set pkb(b_bantime) 5
set pkb(m_mutetime) 60
# set mask type for bans and mutes #
# https://docs.eggheads.org/mainDocs/tcl-commands.html#maskhost-nick-user-host-masktype #
set pkb(ban_masktype) 2
set pkb(mute_masktype) 4
set pkb(mute_maskpre) "~q:"
# protected hosts #
# set only username bans on these domains (ex. *!uid123457@*) #
set pkb(phosts) "*.irccloud.com *.mibbit.com *.kiwiirc.com *.8C39393E.IP"
##############
bind pub -|- !k pub:kick
bind pub -|- .k pub:kick
proc pub:kick {nk uh hn ch tx} { pub:kickban $nk $uh $hn $ch $tx k }
bind pub -|- !b pub:ban
bind pub -|- .b pub:ban
proc pub:ban {nk uh hn ch tx} { pub:kickban $nk $uh $hn $ch $tx b }
bind pub -|- !m pub:muteban
bind pub -|- .m pub:muteban
proc pub:muteban {nk uh hn ch tx} { pub:kickban $nk $uh $hn $ch $tx m }
bind pub -|- !ub pub:unban
bind pub -|- .ub pub:unban
proc pub:unban {nk uh hn ch tx} { pub:kickban $nk $uh $hn $ch $tx ub }
bind pub -|- !um pub:unmute
bind pub -|- .um pub:unmute
proc pub:unmute {nk uh hn ch tx} { pub:kickban $nk $uh $hn $ch $tx um }
bind pub -|- !kb pub:kickban
bind pub -|- .kb pub:kickban
proc pub:kickban {nk uh hn ch tx {do kb} } {
global pkb storehosts
if {$uh ne "Timer"} {
if {![isop $nk $ch] && ![ishalfop $nk $ch] && ![matchattr $hn o|o $ch]} {
return 0
}
}
if {[string match u* $do]} {
set plus "-"
set nickls [split [string trim $tx]]
} else {
set plus "+"
set reason [join [lrange [split $tx "."] 1 end] "."]
if {$reason eq ""} { set reason "Please change your behaviour thank you." }
set nickls [split [string trim [lindex [split $tx "."] 0]]]
}
set seconds 0
if {[string is digit [lindex $nickls end]]} {
if {[string match {[bm]} $do] || ($do eq "kb")} {
set seconds [expr {[lindex $nickls end] * 60}]
}
set nickls [lrange $nickls 0 end-1]
} elseif {$do eq "m"} { set seconds [expr {$pkb(m_mutetime) * 60}]
} elseif {$do eq "b"} { set seconds [expr {$pkb(b_bantime) * 60}]
} elseif {$do eq "kb"} { set seconds [expr {$pkb(kb_bantime) * 60}] }
set masktype $pkb(ban_masktype)
if {[string match *m $do]} { set masktype $pkb(mute_masktype) }
foreach nick $nickls {
if {$nick eq ""} { continue }
if {[string match u* $do] && [string match *!*@* $nick]} {
set bmask $nick
if {($do eq "um") && ![string match $pkb(mute_maskpre)* $bmask]} {
set bmask $pkb(mute_maskpre)$bmask
}
if {[ischanban $bmask $ch]} { lappend bmasks $bmask
} elseif {$uh ne "Timer"} {
putserv "NOTICE $nk :$bmask is not a current ban on $ch"
}
continue
}
set aname [string tolower "$nick@$ch"]
if {[onchan $nick $ch]} {
set hand [nick2hand $nick]
if {![string match u* $do]} {
if {[isop $nick $ch] || [ishalfop $nick $ch]} { continue }
if {[matchattr $hand o|o $ch]} { continue }
}
set chost [getchanhost $nick $ch]
if {[string match {*[bm]} $do]} {
set bmask [mask:host $nick $chost $masktype $do]
if {[string match u* $do] && ![ischanban $bmask $ch]} {
putserv "NOTICE $nk :$bmask \[$nick\] is not a current ban on $ch"
continue
}
lappend bmasks $bmask
if {($do ne "kb") && ![string match u* $do] && [isvoice $nick $ch]} {
lappend dvnicks $nick
}
}
if {[string match k* $do]} { lappend knicks $nick }
} elseif {[info exists storehosts($aname)] && ($do ne "k")} {
if {![string match u* $do]} {
if {[matchattr [lindex $storehosts($aname) 2] o|o $ch]} { continue }
}
set chost [lindex $storehosts($aname) 0]
set bmask [mask:host $nick $chost $masktype $do]
if {[string match u* $do] && ![ischanban $bmask $ch]} {
putserv "NOTICE $nk :$bmask \[$nick\] is not a current ban on $ch"
continue
}
lappend bmasks $bmask
} else { putserv "NOTICE $nk :$nick is not on channel $ch" }
}
if {[info exists dvnicks]} {
while {[set len [llength $dvnicks]] > 0} {
if {$len > $pkb(maxban)} {
set mode [string repeat "v" $pkb(maxban)]
set nicks [join [lrange $dvnicks 0 [expr {$pkb(maxban) - 1}]]]
set dvnicks [lrange $dvnicks $pkb(maxban) end]
} else {
set mode [string repeat "v" $len]
set nicks [join $dvnicks]
set dvnicks ""
}
putquick "MODE $ch -$mode $nicks"
}
}
if {[info exists bmasks]} {
if {$seconds > 0} {
utimer $seconds [list pub:kickban $nk Timer $hn $ch [join $bmasks] ub]
}
while {[set len [llength $bmasks]] > 0} {
if {$len > $pkb(maxban)} {
set mode [string repeat "b" $pkb(maxban)]
set masks [join [lrange $bmasks 0 [expr {$pkb(maxban) - 1}]]]
set bmasks [lrange $bmasks $pkb(maxban) end]
} else {
set mode [string repeat "b" $len]
set masks [join $bmasks]
set bmasks ""
}
putquick "MODE $ch $plus$mode $masks"
}
}
if {[info exists knicks]} {
while {[set len [llength $knicks]] > 0} {
if {$len > $pkb(maxkick)} {
set nicks [join [lrange $knicks 0 [expr {$pkb(maxkick) - 1}]] ","]
set knicks [lrange $knicks $pkb(maxkick) end]
} else {
set nicks [join $knicks ","]
set knicks ""
}
putserv "KICK $ch $nicks :$reason"
}
}
}
#### protected hosts code
set pkb(phosts) [split [string trim $pkb(phosts)]]
proc mask:host {nick chost masktype do} {
set bmask [maskhost "$nick!$chost" $masktype]
foreach phost $::pkb(phosts) {
if {[string match -nocase $phost $chost]} {
set bmask "*![lindex [split $chost @] 0]@*"
break
}
}
if {[string match *m $do]} { set bmask $::pkb(mute_maskpre)$bmask }
return $bmask
}
#### stored nicks & uhosts code
bind part - * store:hosts
bind sign - * store:hosts
proc store:hosts {nk uh hn ch msg} {
set aname [string tolower $nk@$ch]
set ::storehosts($aname) [list $uh [expr {[unixtime]+900}] $hn]
}
bind kick - * store:kick
proc store:kick {nk uh hn ch target reason} {
set uhost [getchanhost $target $ch]
set hand [finduser $target!$uhost]
store:hosts $target $uhost $hand $ch pkb.tcl
}
bind time - * expire:hosts
proc expire:hosts {mn hr da mo yr} {
global storehosts
set ut [unixtime]
foreach {aname avalue} [array get storehosts] {
if {$ut >= [lindex $avalue 1]} { unset storehosts($aname) }
}
}
|
_________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
Back to top |
|
 |
Gulio Halfop
Joined: 01 Nov 2020 Posts: 73
|
Posted: Mon Jul 05, 2021 4:15 pm Post subject: Hello |
|
|
Spike^^ now i tested the Kick and KB from CS and from my script Mirc and is work saves the kick , this is great , thx a lot again . |
|
Back to top |
|
 |
|