Kod: Kodu kopyalamak için üzerine çift tıklayın!
# === Ayarlar ===
set yasak_komutlar {.kickradyo .djal .voiceal}
set allowed_users {AdminNick Deneme}
set komut_log_dosya "komut_koruma.log"
set komut_log_limit 1048576 ;# 1 MB
# === Yetki kontrolü ===
proc is_authorized_user {nick hand chan} {
global allowed_users
if {$hand eq "*"} { return 0 } ;# Userlist'te yoksa handle koruması
# op / master / halfop kontrolü
if {[matchattr $hand o|o $chan]} { return 1 }
if {[matchattr $hand m|m]} { return 1 }
if {[matchattr $hand h|h $chan]} { return 1 }
# Manuel izinli kullanıcılar
if {[lsearch -nocase $allowed_users $nick] != -1} { return 1 }
return 0
}
# === Log dosyası kontrolü ===
proc kontrol_log_boyutu {} {
global komut_log_dosya komut_log_limit
if {[file exists $komut_log_dosya]} {
set boyut [file size $komut_log_dosya]
if {$boyut > $komut_log_limit} {
set eski "${komut_log_dosya}.old"
catch {file delete -force $eski}
catch {file rename -force $komut_log_dosya $eski}
putlog "komut_koruma_dj.tcl >> Log dosyası limit aştı ($boyut byte) — eski log yedeklendi: $eski"
}
}
}
# === Log yazıcı ===
proc logla_yasakli_komut {chan nick uhost text} {
global komut_log_dosya
kontrol_log_boyutu
set zaman [strftime "%d.%m.%Y %H:%M:%S"]
set satir "$zaman [string toupper $chan] >> $nick ($uhost) yasaklı komutu denedi: $text"
putlog $satir
if {[catch {set f [open $komut_log_dosya "a+"]} err]} {
putlog "HATA: Log dosyasına yazılamadı ($komut_log_dosya): $err"
return
}
puts $f $satir
close $f
}
# === Mesaj dinleyici ===
bind pubm - "*" kontrol_pub_mesaj
proc kontrol_pub_mesaj {nick uhost hand chan text} {
global yasak_komutlar
# sadece #dj kanalında aktif
if {![string match -nocase "#dj" $chan]} { return 0 }
set text [string trimleft $text]
foreach cmd $yasak_komutlar {
if {[string match -nocase "${cmd}*" $text]} {
if {![is_authorized_user $nick $hand $chan]} {
putquick "NOTICE $nick :❌ $cmd komutunu kullanma yetkiniz yok!"
putquick "PRIVMSG $chan :$nick bu komutu kullanamaz!"
logla_yasakli_komut $chan $nick $uhost $text
# Eğer atmak istiyorsan şu satırı aktif et:
# putquick "KICK $chan $nick :Yetkisiz komut kullanımı ($cmd)"
break
}
}
}
return 0
}
putlog "✅ komut_koruma_dj.tcl yüklendi — #dj kanalında aktif (yasaklı komutlar: .kickradyo, .djal, .voiceal)"
Bu hali ile dener misin