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.
Help for those learning Tcl or writing their own scripts.
simo
Revered One
Posts: 1128 Joined: Sun Mar 22, 2015 2:41 pm
Post
by simo » Sun Oct 05, 2025 11:39 am
greetings ,
the idea is to store each nick on join in a list after a check for not being admin ops halfops and such than to add in a list to send to a proc to do whois on all the stored nicks after like 5 minutes to check for blacklisted channels and clear all checked nicks from the stored list im not sure i'm on the right track with this code :
Code: Select all
namespace eval checkbadchan {
bind join - * [namespace current]::Djoin:badChnz:Checker
setudef flag chckbadchan
if {[string match "*BadChan:Scan*" [utimers]] == 0} {
utimer 5 [namespace current]::BadChan:Scan
}
proc Djoin:badChnz:Checker {nick uhost hand chan} {
global chkbchan
if {![channel get $chan chckbadchan]} { return 0 }
if {[isbotnick $nick] || [matchattr $hand of|of $chan]} { return 0 }
after [expr {2*1000*1}] [list [namespace current]::Delay-join:badChnz:Chk $nick $uhost $chan]
}
proc Delay-join:badChnz:Chk {nick uhost chan} {
global chkbchan
set ::badchanwhois [list]
if {![channel get $chan chckbadchan]} { return 0 }
if {[isbotnick $nick] || [isop $nick $chan] || [ishalfop $nick $chan] || [matchattr [nick2hand $nick] of|of $chan]} { return 0 }
if {[lsearch -exact $::badchanwhois "[string tolower $nick] $chan"] == -1} { lappend ::badchanwhois [string tolower $nick] $chan }
}
proc BadChan:Scan { } {
set badwhoisonchan [list]
if {[string match "*BadChan:Scan*" [utimers]] == 0} {
utimer 5 [namespace current]::BadChan:Scan
}
if {![info exists ::badchanwhois]} { return 0 }
foreach {nick chan} $::badchanwhois {
if {[onchan $nick $chan] } { lappend badwhoisonchan [string tolower $nick] }
}
if {[info exists badwhoisonchan]} { [namespace current]::Stck:WHoiZ $chan $badwhoisonchan }
}
proc Stck:WHoiZ {chan userList {max 20}} {
set ::chanxer $chan
set userList [lsort -unique $userList]
set count [llength $userList]
set counter 0
while {$count > 0} {
if {$count > $max} {
set users [join [lrange $userList 0 [expr {$max - 1}]] ","]
set userList [lreplace $userList 0 [expr {$max -1}]]
incr count -$max
} else {
set users [join $userList ","]
set count 0
}
incr counter 1
after [expr {$counter*5000}] [list putserv "Whois :$users"]
}
bind raw - 319 [namespace current]::Check_BChanz
}
proc Check_BChanz {from key arg} {
global listbadchans
set chans [list]
set args [join $arg]
set nick [lindex $arg 1]
if {[onchan $nick $::chanxer]} { set chost [getchanhost $nick $::chanxer] }
set badchans [list]
set chans [lrange $args 2 e]
foreach tok $chans {
set tok [string trimleft $tok ":@%+"]
if {[regexp -nocase {slut|bdsm|s[0o]d[0o]m|daughter|wh[0o]r[3e]|subm[i1]ss[1i]v[3e]|s[3e]ks|s[3e]cs|tits|pr[3e]gn[4a]t[1i]|pregnant|Rape|r[0o]l[3e]pl[a4]y|ambition|s[3e]ks|g[a4]y|[sf][4u]ck|inc[3e]st|s[3e]x|th[i1]rsty|c[4u]m|t[3e][3e]nw[a4]nk[i1]n|h[0o]m[0o|se(x|ks)|(s|f)uck|p(orn|0rn|enis)|h[0o]rny} $tok]} {
lappend badchans $tok
}
}
if {[llength $badchans]} {
putlog "Bad Channel Detected For $nick - [join $badchans]"
if {[string match -nocase "*@*irccloud*" $chost]} {
set ident [string trimleft [lindex [split $chost @] 0] "~"]
set xbmaskx [string map {sid id uid id} $ident]
set bmask *!*[string tolower $xbmaskx ]@*
} else { set bmask "*!*@[lindex [split $chost "@"] 1]" }
if {![ischanban $bmask $::chanxer]} { pushmode $::chanxer +b $bmask }
if {[onchan $nick $::chanxer]} {
putserv "privmsg $nick :\00312,00 $nick \00301 You Are In An Unallowed Channel\(S\)\: \00306 \037[join $badchans]\037 \00301 Part It/Them And Rejoin \00310 \037$::chanxer\037 \00301 Later After Your Ban Has Expired \017"
putserv "kick $::chanxer $nick :\002\00312,00 «-BAD/BlackListed & OR Spam CHANNEL DETECTED-» \017" }
}
return 0
}
}
putlog "[file normalize [info script]]"
ive tested it a few times and it doesnt seem to get all the nicks to boot out if they are in a blacklisted channel.
Thanks in advance.
pektek
Halfop
Posts: 71 Joined: Sat Jul 01, 2023 4:51 pm
Post
by pektek » Sun Nov 30, 2025 9:21 am
corrected version
Code: Select all
namespace eval checkbadchan {
bind join - * [namespace current]::Djoin:badChnz:Checker
setudef flag chckbadchan
if {[string match "*BadChan:Scan*" [utimers]] == 0} {
utimer 5 [namespace current]::BadChan:Scan
}
proc Djoin:badChnz:Checker {nick uhost hand chan} {
if {![channel get $chan chckbadchan]} { return 0 }
if {[isbotnick $nick] || [matchattr $hand of|of $chan]} { return 0 }
after 2000 [list [namespace current]::Delay-join:badChnz:Chk $nick $uhost $chan]
}
proc Delay-join:badChnz:Chk {nick uhost chan} {
if {![channel get $chan chckbadchan]} { return 0 }
if {[isbotnick $nick] || [isop $nick $chan] || [ishalfop $nick $chan] || [matchattr [nick2hand $nick] of|of $chan]} { return 0 }
if {![info exists ::badchanwhois]} { set ::badchanwhois [list] }
if {[lsearch -exact $::badchanwhois "[string tolower $nick] $chan"] == -1} {
lappend ::badchanwhois [string tolower $nick] $chan
}
}
proc BadChan:Scan {} {
set badwhoisonchan [list]
if {[string match "*BadChan:Scan*" [utimers]] == 0} {
utimer 5 [namespace current]::BadChan:Scan
}
if {![info exists ::badchanwhois]} { return 0 }
foreach {nick chan} $::badchanwhois {
if {[onchan $nick $chan]} {
lappend badwhoisonchan [string tolower $nick]
}
}
if {[info exists badwhoisonchan]} {
[namespace current]::Stck:WHoiZ $chan $badwhoisonchan
}
}
proc Stck:WHoiZ {chan userList {max 20}} {
set ::chanxer $chan
set userList [lsort -unique $userList]
set count [llength $userList]
set counter 0
while {$count > 0} {
if {$count > $max} {
set users [join [lrange $userList 0 [expr {$max - 1}]] ","]
set userList [lreplace $userList 0 [expr {$max - 1}]]
incr count -$max
} else {
set users [join $userList ","]
set count 0
}
incr counter 1
after [expr {$counter * 5000}] [list putserv "Whois :$users"]
}
bind raw - 319 [namespace current]::Check_BChanz
}
proc Check_BChanz {from key arg} {
set args [join $arg]
set nick [lindex $arg 1]
if {[onchan $nick $::chanxer]} {
set chost [getchanhost $nick $::chanxer]
}
set chans [lrange $args 2 end]
set badchans [list]
# ------------------- BANLANACAK KELIME/KANAL REGEX -------------------
if {[regexp -nocase {
slut|bdsm|s[0o]d[0o]m|daughter|wh[0o]r[3e]|subm[i1]ss[1i]v[3e]|
s[3e]ks|s[3e]cs|tits|pr[3e]gn[4a]t[1i]|pregnant|rape|r[0o]l[3e]pl[a4]y|
ambition|g[a4]y|[sf][4u]ck|inc[3e]st|s[3e]x|th[i1]rsty|c[4u]m|
t[3e][3e]nw[a4]nk[i1]n|(s|f)uck|p(orn|0rn|enis)|h[0o]rny|
h[0o]m[0o]se(x|ks)
} $args]} {
lappend badchans $args
}
# ----------------------------------------------------------------------
if {[llength $badchans]} {
putlog "⚠ Bad Channel Detected → $nick | [join $badchans]"
# IRCCloud kullanıcı maskesi
if {[string match -nocase "*@*irccloud*" $chost]} {
set ident [string trimleft [lindex [split $chost @] 0] "~"]
set xbmaskx [string map {sid id uid id} $ident]
set bmask *!*[string tolower $xbmaskx]@*
} else {
set bmask "*!*@[lindex [split $chost "@"] 1]"
}
if {![ischanban $bmask $::chanxer]} {
pushmode $::chanxer +b $bmask
}
if {[onchan $nick $::chanxer]} {
putserv "privmsg $nick :\00312$nick\00301 Yasaklı/Blacklisted Kanal Tespit Edildi → \00304[join $badchans]\003"
putserv "kick $::chanxer $nick :\00304« BAD / BLACKLISTED SPAM CHANNEL »\017"
}
}
return 0
}
}
putlog "Loaded → [file normalize [info script]]"
simo
Revered One
Posts: 1128 Joined: Sun Mar 22, 2015 2:41 pm
Post
by simo » Sun Nov 30, 2025 1:25 pm
thanks for your reply
Ive tested it and got this error :
Tcl error [::checkbadchan::Check_BChanz]: can't read "chost": no such variable
simo
Revered One
Posts: 1128 Joined: Sun Mar 22, 2015 2:41 pm
Post
by simo » Sun Nov 30, 2025 2:02 pm
also the timer doesnt get cleared
after#858 = {putserv {Whois :alard,circosta,consuela,dragone,fanya,ioab,nakasuji,pavlov,sisson,tremayne}} timer
pektek
Halfop
Posts: 71 Joined: Sat Jul 01, 2023 4:51 pm
Post
by pektek » Tue Dec 02, 2025 11:56 am
try this ;
If there is a mistake, just tell me, my friend.
Code: Select all
namespace eval checkbadchan {
bind join - * [namespace current]::Djoin:badChnz:Checker
setudef flag chckbadchan
if {[string match "*BadChan:Scan*" [utimers]] == 0} {
utimer 5 [namespace current]::BadChan:Scan
}
proc Djoin:badChnz:Checker {nick uhost hand chan} {
if {![channel get $chan chckbadchan]} { return 0 }
if {[isbotnick $nick] || [matchattr $hand of|of $chan]} { return 0 }
after 2000 [list [namespace current]::Delay-join:badChnz:Chk $nick $uhost $chan]
}
proc Delay-join:badChnz:Chk {nick uhost chan} {
if {![channel get $chan chckbadchan]} { return 0 }
if {[isbotnick $nick] || [isop $nick $chan] || [ishalfop $nick $chan] || [matchattr [nick2hand $nick] of|of $chan]} { return 0 }
if {![info exists ::badchanwhois]} { set ::badchanwhois [list] }
if {[lsearch -exact $::badchanwhois "[string tolower $nick] $chan"] == -1} {
lappend ::badchanwhois [string tolower $nick] $chan
}
}
proc BadChan:Scan {} {
set badwhoisonchan [list]
if {[string match "*BadChan:Scan*" [utimers]] == 0} {
utimer 5 [namespace current]::BadChan:Scan
}
if {![info exists ::badchanwhois]} { return 0 }
foreach {nick chan} $::badchanwhois {
if {[onchan $nick $chan]} {
lappend badwhoisonchan [string tolower $nick]
}
}
if {[llength $badwhoisonchan]} {
[namespace current]::Stck:WHoiZ $chan $badwhoisonchan
}
}
proc Stck:WHoiZ {chan userList {max 20}} {
set ::chanxer $chan
set userList [lsort -unique $userList]
set count [llength $userList]
set counter 0
while {$count > 0} {
if ($count > $max) {
set users [join [lrange $userList 0 [expr {$max - 1}]] ","]
set userList [lreplace $userList 0 [expr {$max - 1}]]
incr count -$max
} else {
set users [join $userList ","]
set count 0
}
incr counter 1
after [expr {$counter * 5000}] [list putserv "Whois :$users"]
}
bind raw - 319 [namespace current]::Check_BChanz
}
proc Check_BChanz {from key arg} {
set args [join $arg]
set nick [lindex $arg 1]
# Hata engellemek için default host
set chost ""
# Kullanıcı kanalda ise host’u al
if {[onchan $nick $::chanxer]} {
set chost [getchanhost $nick $::chanxer]
}
# Host yine boşsa işlem yapma — hata engelliyoruz
if {$chost eq ""} {
return 0
}
set badchans [list]
# ------------------ KARA LİSTE REGEX ------------------
if {[regexp -nocase {
slut|bdsm|s[0o]d[0o]m|daughter|wh[0o]r[3e]|subm[i1]ss[1i]v[3e]|
s[3e]ks|s[3e]cs|tits|pr[3e]gn[4a]t[1i]|pregnant|rape|r[0o]l[3e]pl[a4]y|
ambition|g[a4]y|[sf][4u]ck|inc[3e]st|s[3e]x|th[i1]rsty|c[4u]m|
t[3e][3e]nw[a4]nk[i1]n|(s|f)uck|p(orn|0rn|enis)|h[0o]rny|
h[0o]m[0o]se(x|ks)
} $args]} {
lappend badchans $args
}
# -------------------------------------------------------
if {[llength $badchans]} {
putlog "Bad Channel Detected → $nick | [join $badchans]"
# IRCCloud mask fix
if {[string match -nocase "*@*irccloud*" $chost]} {
set ident [string trimleft [lindex [split $chost @] 0] "~"]
set xbmaskx [string map {sid id uid id} $ident]
set bmask *!*[string tolower $xbmaskx]@*
} else {
set bmask "*!*@[lindex [split $chost @] 1]"
}
if {![ischanban $bmask $::chanxer]} {
pushmode $::chanxer +b $bmask
}
if {[onchan $nick $::chanxer]} {
putserv "privmsg $nick :\00312$nick\00301 Yasaklı / Blacklisted Kanal Tespit Edildi → \00304[join $badchans]\003"
putserv "kick $::chanxer $nick :\00304« BAD / BLACKLISTED SPAM CHANNEL »\017"
}
}
return 0
}
}
putlog "Loaded → [file normalize [info script]]"