Home / Pastebin / 8pK6KGAPbj7bVljUEuZrOBFhze8SaAHJ
Back to Pastebin

floatlimit.tcl

dracorex  ·  March 31, 2026, 5:23 a.m.  ·  45 views
Plain Text

							
##############################################################################
# FloatLimit.tcl (Fixed Version)
# Maintains +l (Users + 1) across ALL channels where the bot is Opped.
##############################################################################

namespace eval FloatLimit {
    variable join_delay 30
    variable sync_delay 500
    bind join - * [namespace current]::trigger_join
    bind part - * [namespace current]::trigger_sync
    bind kick - * [namespace current]::trigger_kick
    bind sign - * [namespace current]::trigger_quit
    proc trigger_join {nick uhost hand chan} {
        variable join_delay
        foreach t [utimers] {
            if {[string match "*update_limit $chan*" [lindex $t 1]]} {
                killutimer [lindex $t 2]
            }
        }
        utimer $join_delay [list [namespace current]::update_limit $chan]
    }
    proc trigger_sync {nick uhost hand chan {arg ""}} {
        variable sync_delay
        after $sync_delay [list [namespace current]::update_limit $chan]
    }
    proc trigger_kick {nick uhost hand chan target reason} {
        trigger_sync $nick $uhost $hand $chan
    }
    proc trigger_quit {nick uhost hand chan reason} {
             trigger_sync $nick $uhost $hand $chan
    }
    proc update_limit {chan} {
        if {![validchan $chan] || ![botisop $chan]} { return }
        set user_count [llength [chanlist $chan]]
        set new_limit [expr {$user_count + 1}]
        set current_modes [getchanmode $chan]
        if {[regexp {l (\d+)} $current_modes -> old_limit]} {
            if {$old_limit == $new_limit} { return }
        }
        putserv "MODE $chan +l $new_limit"
    }
}

putlog "FloatLimit.tcl (Tight) loaded: Monitoring all Opped channels, by dracorex."

Actions

Paste Info

ID: 8pK6KGAPbj7bVljUEuZrOBFhze8SaAHJ
Language: Plain Text
Size: 1802 chars
Expires: Never