Tekil Mesaj gösterimi
Alt 07 Ağustos 2026, 02:36   #3
KivanC Editör
✓
W r i t e r
KivanC - ait Kullanıcı Resmi (Avatar)

Standart Xline yerine Kill olarak da kullanabilirsiniz

HTML-Kodu

###########################################################
#          P-Nick Yonetim Sistemi - pnick.tcl             #
#          https://www.Sohbetlive.com.tr                    #
#          v1.0.2 - KILL Komutu Guncellemesi              #
###########################################################

# ============================================
# KANAL AYARLARI
# ============================================

set pnick(chan) "#Badnick"
set pnick(chan2) "#System"
set pnick(debug) 1

# ============================================
# KILL AYARLARI
# ============================================

set pnick(kill-reason) "Yasakli nick listesinde"

# Oper bilgileri
set pnick(oper-nick) "Eggdrop"
set pnick(oper-pass) "eggsifresi"


array set pnick_list {}


proc pnick:load {} {
    global pnick_list
    set dosya "scripts/pnick_list.txt"

    if {[file exists $dosya]} {
        set fp [open $dosya r]
        while {[gets $fp satir] >= 0} {
            set satir [string trim $satir]
            if {$satir != ""} {
                set pnick_list([string tolower $satir]) 1
            }
        }
        close $fp
        putlog "PNICK: [array size pnick_list] nick yuklendi."
    } else {
        putlog "PNICK: pnick_list.txt bulunamadi, bos liste olusturuldu."
    }
}

proc pnick:save {} {
    global pnick_list
    set dosya "scripts/pnick_list.txt"

    set fp [open $dosya w]
    foreach {nick deger} [array get pnick_list] {
        puts $fp $nick
    }
    close $fp
    putlog "PNICK: [array size pnick_list] nick kaydedildi."
}

# ============================================
# KANALA BILDIRIM - putserv kullan (daha guvenilir)
# ============================================

proc pnick:notify {msg} {
    global pnick
    putserv "PRIVMSG $pnick(chan) :\00304\[PNICK\]\003 $msg"
    putlog "PNICK-NOTIFY: $msg"
}

# ============================================
# SERVER NOTICE FILTRELEME
# ============================================

bind raw - NOTICE pnick:raw_notice

proc pnick:raw_notice {from keyword text} {
    global pnick pnick_list

    if {$pnick(debug)} {
        putlog "PNICK-DEBUG: RAW NOTICE from=$from text=$text"
    }

    # Client connecting - nick kontrol et ve Kill at
    if {[string match "*Client connecting on port*" $text]} {
        if {$pnick(debug)} {
            putlog "PNICK-DEBUG: Client connecting MATCH"
        }

        if {[regexp {Client connecting on port [0-9]+: ([^ ]+)} $text -> cnick]} {
            if {$pnick(debug)} {
                putlog "PNICK-DEBUG: Nick bulundu: $cnick"
            }

            set lcnick [string tolower $cnick]
            if {[info exists pnick_list($lcnick)]} {
                if {$pnick(debug)} {
                    putlog "PNICK-DEBUG: Nick listede VAR: $cnick"
                }

                pnick:apply_kill $cnick
                putlog "PNICK: Yasakli nick baglandi - $cnick - Kill atildi."
                pnick:notify "Yasakli nick baglandi: \002$cnick\002 - Kill atildi."
            } else {
                if {$pnick(debug)} {
                    putlog "PNICK-DEBUG: Nick listede YOK: $cnick"
                }
            }
        }
        return 0
    }

    # Q-line mesajlarini sessizce yut
    if {[string match "*Forbidding Q-lined nick*" $text]} {
        putlog "PNICK: Q-line mesaji (sessiz): $text"
        return 1
    }

    return 0
}

# ============================================
# NICK KONTROLU - Join / Nick Change
# ============================================

bind join - * pnick:check_join
bind nick - * pnick:check_nick

proc pnick:check_join {nick uhost hand chan} {
    global pnick pnick_list

    if {$pnick(debug)} {
        putlog "PNICK-DEBUG: JOIN nick=$nick uhost=$uhost chan=$chan"
    }

    set lnick [string tolower $nick]
    if {[info exists pnick_list($lnick)]} {
        pnick:apply_kill $nick
        putlog "PNICK: Yasakli nick join - $nick - Kill atildi."
        pnick:notify "Yasakli nick giris: \002$nick\002 - Kill atildi."
    }
}

proc pnick:check_nick {nick uhost hand chan newnick} {
    global pnick pnick_list

    if {$pnick(debug)} {
        putlog "PNICK-DEBUG: NICK CHANGE old=$nick new=$newnick uhost=$uhost"
    }

    set lnewnick [string tolower $newnick]
    if {[info exists pnick_list($lnewnick)]} {
        pnick:apply_kill $newnick
        putlog "PNICK: Yasakli nick degisimi - $newnick - Kill atildi."
        pnick:notify "Yasakli nick degisimi: \002$newnick\002 - Kill atildi."
    }
}


proc pnick:apply_kill {nick} {
    global pnick

    if {$pnick(debug)} {
        putlog "PNICK-DEBUG: KILL atiliyor - nick=$nick"
    }

    putserv "OPER $pnick(oper-nick) $pnick(oper-pass)"
    putserv "KILL $nick :$pnick(kill-reason)"

    putlog "PNICK: Kill uygulandi - $nick"
}

# ============================================
# YETKI KONTROLU - isop veya ishalfop
# ============================================

proc pnick:isoper {nick chan} {
    if {[isop $nick $chan]} { return 1 }
    if {[ishalfop $nick $chan]} { return 1 }
    return 0
}

# ============================================
# KOMUTLAR
# ============================================

bind pub -|- "!pnick-ekle" pnick:cmd_ekle
bind pub -|- "!pnick-sil" pnick:cmd_sil
bind pub -|- "!pnick-liste" pnick:cmd_liste
bind pub -|- "!pnick-say" pnick:cmd_say
bind pub -|- "!pnick-yenile" pnick:cmd_yenile
bind pub -|- "!pnick-debug" pnick:cmd_debug
bind pub -|- "!komutlar" pnick:cmd_komutlar

proc pnick:check_chan {chan} {
    global pnick
    if {$chan == $pnick(chan) || $chan == $pnick(chan2)} {
        return 1
    }
    return 0
}

proc pnick:cmd_ekle {nick uhost hand chan text} {
    global pnick pnick_list
    if {![pnick:check_chan $chan]} { return }
    if {![pnick:isoper $nick $chan]} {
        puthelp "PRIVMSG $chan :\00304\[PNICK\]\003 Bu komutu sadece +h/+o kullanabilir."
        return
    }

    set eklenecek [string trim $text]
    if {$eklenecek == ""} {
        puthelp "PRIVMSG $chan :Kullanim: !pnick-ekle <nick>"
        return
    }

    set pnick_list([string tolower $eklenecek]) 1
    pnick:save
    puthelp "PRIVMSG $chan :\00304\[PNICK\]\003 '\002$eklenecek\002' listeye eklendi."
    putlog "PNICK: $nick tarafindan '$eklenecek' eklendi."
}

proc pnick:cmd_sil {nick uhost hand chan text} {
    global pnick pnick_list
    if {![pnick:check_chan $chan]} { return }
    if {![pnick:isoper $nick $chan]} {
        puthelp "PRIVMSG $chan :\00304\[PNICK\]\003 Bu komutu sadece +h/+o kullanabilir."
        return
    }

    set silinecek [string trim $text]
    if {$silinecek == ""} {
        puthelp "PRIVMSG $chan :Kullanim: !pnick-sil <nick>"
        return
    }

    set lsilinecek [string tolower $silinecek]
    if {[info exists pnick_list($lsilinecek)]} {
        unset pnick_list($lsilinecek)
        pnick:save
        puthelp "PRIVMSG $chan :\00304\[PNICK\]\003 '\002$silinecek\002' listeden silindi."
        putlog "PNICK: $nick tarafindan '$silinecek' silindi."
    } else {
        puthelp "PRIVMSG $chan :\00304\[PNICK\]\003 '\002$silinecek\002' listede bulunamadi."
    }
}

proc pnick:cmd_liste {nick uhost hand chan text} {
    global pnick pnick_list
    if {![pnick:check_chan $chan]} { return }
    if {![pnick:isoper $nick $chan]} {
        puthelp "PRIVMSG $chan :\00304\[PNICK\]\003 Bu komutu sadece +h/+o kullanabilir."
        return
    }

    set sayi [array size pnick_list]
    puthelp "PRIVMSG $chan :\00304\[PNICK\]\003 Toplam \002$sayi\002 yasakli nick var."

    if {$sayi == 0} { return }

    set liste ""
    set sayac 0
    foreach {nick deger} [array get pnick_list] {
        append liste "$nick "
        incr sayac
        if {$sayac >= 30} {
            puthelp "PRIVMSG $chan :\00304\[PNICK\]\003 $liste"
            set liste ""
            set sayac 0
        }
    }
    if {$liste != ""} {
        puthelp "PRIVMSG $chan :\00304\[PNICK\]\003 $liste"
    }
}

proc pnick:cmd_say {nick uhost hand chan text} {
    global pnick pnick_list
    if {![pnick:check_chan $chan]} { return }
    if {![pnick:isoper $nick $chan]} {
        puthelp "PRIVMSG $chan :\00304\[PNICK\]\003 Bu komutu sadece +h/+o kullanabilir."
        return
    }

    set sayi [array size pnick_list]
    puthelp "PRIVMSG $chan :\00304\[PNICK\]\003 Toplam \002$sayi\002 yasakli nick kayitli."
}

proc pnick:cmd_yenile {nick uhost hand chan text} {
    global pnick pnick_list
    if {![pnick:check_chan $chan]} { return }
    if {![pnick:isoper $nick $chan]} {
        puthelp "PRIVMSG $chan :\00304\[PNICK\]\003 Bu komutu sadece +h/+o kullanabilir."
        return
    }

    array unset pnick_list
    pnick:load
    set sayi [array size pnick_list]
    puthelp "PRIVMSG $chan :\00304\[PNICK\]\003 Liste yenilendi. \002$sayi\002 nick yuklendi."
    putlog "PNICK: $nick listeyi yeniledi."
}

proc pnick:cmd_debug {nick uhost hand chan text} {
    global pnick pnick_list
    if {![pnick:check_chan $chan]} { return }
    if {![pnick:isoper $nick $chan]} {
        puthelp "PRIVMSG $chan :\00304\[PNICK\]\003 Bu komutu sadece +h/+o kullanabilir."
        return
    }

    if {$pnick(debug)} {
        set pnick(debug) 0
        puthelp "PRIVMSG $chan :\00304\[PNICK\]\003 Debug modu \002KAPANDI\002."
    } else {
        set pnick(debug) 1
        puthelp "PRIVMSG $chan :\00304\[PNICK\]\003 Debug modu \002ACILDI\002."
    }
    putlog "PNICK: Debug modu $pnick(debug) olarak degistirildi."
}

proc pnick:cmd_komutlar {nick uhost hand chan text} {
    global pnick
    if {![pnick:check_chan $chan]} { return }

    puthelp "PRIVMSG $chan :\00304\[PNICK\]\003 \002Komutlar:\002"
    puthelp "PRIVMSG $chan :\00304\[PNICK\]\003 !pnick-ekle <nick>  - Listeye nick ekle"
    puthelp "PRIVMSG $chan :\00304\[PNICK\]\003 !pnick-sil <nick>   - Listeden nick sil"
    puthelp "PRIVMSG $chan :\00304\[PNICK\]\003 !pnick-liste        - Yasakli nickleri listele"
    puthelp "PRIVMSG $chan :\00304\[PNICK\]\003 !pnick-say          - Toplam nick sayisi"
    puthelp "PRIVMSG $chan :\00304\[PNICK\]\003 !pnick-yenile       - Listeyi dosyadan yenile"
    puthelp "PRIVMSG $chan :\00304\[PNICK\]\003 !pnick-debug        - Debug modu ac/kapa"
    puthelp "PRIVMSG $chan :\00304\[PNICK\]\003 !komutlar           - Bu listeyi goster"
    puthelp "PRIVMSG $chan :\00304\[PNICK\]\003 \002Not:\002 +h veya +o yetkisi gerekir."
}


bind time - "*/10 * * * *" pnick:autosave
proc pnick:autosave {min hour day month year} {
    pnick:save
}

pnick:load

putlog "pnick.tcl yuklendi - P-Nick Yonetim Sistemi v1.0.2"
putlog "PNICK: Kanal: $pnick(chan) / $pnick(chan2)"
putlog "PNICK: Kanal bildirimleri aktif (putserv)"
putlog "PNICK: Yetki: +h veya +o"
putlog "PNICK: Komutlar: !pnick-ekle !pnick-sil !pnick-liste !pnick-say !pnick-yenile !pnick-debug !komutlar"

________________

"Sevilmenin kıymeti bilinmiyorsa, Uzaklaşmak En güzeli ki üzülen sen olmayasın"