All pastes #286351 Raw Edit

Untitled

public text v1 · immutable
#286351 ·published 2006-12-20 16:28 UTC
rendered paste body
bind msg -|- !voice css_voice
bind join - * css_join
bind msg -|- !promote css_promote
bind msg -|- !demote css_demote

proc css_voice {nick host hand arg} {
        set args [string trim $arg]
        set channel [lindex [split $args " "] 0]
        set md5 [lindex [split $args " "] 1]

        if {[md5 $nick] == $md5} {
                puthelp "NOTICE $nick :Voice on the way"
                puthelp "MODE $channel +v $nick"
        } else {
                puthelp "NOTICE $nick :Invalid voice command"
                putlog "VOICE NOT OK";
        }
}
proc css_greet {nick chan} {
        puthelp "NOTICE $nick :Welcome to $chan. Please \002/msg \[W3C\]Bot !voice $chan [md5 $nick]\002 to get voice"
        puthelp "NOTICE $nick :Please note this is \002_NOT_\002 a CounterStrike channel"
}
proc css_greet_voice {nick chan} {
        puthelp "NOTICE $nick :Welcome back to $chan. You will be auto-voiced shortly"
        puthelp "NOTICE $nick :Please note this is \002_NOT_\002 a CounterStrike channel"
}
proc css_promote {user uhost hand arg} {
        set args [string trim $arg]
        set channel [lindex [split $args " "] 0]
        set nick [lindex [split $args " "] 1]

        if {![isop $user $channel]} {
                putlog "HACK ATTEMPT"
                puthelp "NOTICE $user :Your not administrator of $channel"
                return
        }
        if {[adduser $nick $nick!*@*]} {
                putlog "Added user $nick to the system"
        }

        if {[matchattr $nick |r $channel]} {
                puthelp "NOTICE $user :$nick is already regular on this channel"
                return
        }

        chattr $nick |+r $channel

        puthelp "NOTICE $user :Successfully added $nick as regular on $channel"
        puthelp "NOTICE $nick :You have been added as regular on $channel and will get autovoice from now on"
}
proc css_demote {user uhost hand arg} {
        set args [string trim $arg]
        set channel [lindex [split $args " "] 0]
        set nick [lindex [split $args " "] 1]

        if {![isop $user $channel]} {
                putlog "HACK ATTEMPT"
                puthelp "NOTICE $user :Your not administrator of $channel"
                return
        }
        if {![matchattr $nick |r $channel]} {
                puthelp "NOTICE $user :$nick isnt regular on this channel"
                return
        }

        chattr $nick |-r $channel

        puthelp "NOTICE $user :Successfully removed $nick as regular on $channel"
        puthelp "NOTICE $nick :You have been removed as regular on $channel and will nolonger get autovoice"
}
proc css_ignore {user uhost hand arg} {
        set args [string trim $arg]
        set channel [lindex [split $args " "] 0]
        set host [lindex [split $args " "] 1]

        if {![isop $user $channel]} {
                putlog "HACK ATTEMPT"
                puthelp "NOTICE $user :Your not administrator of $channel"
                return
        }

        if {[adduser $nick $nick!*@*]} {
                putlog "Added user $nick to the system"
        }

        if {[matchattr $nick |r $channel]} {
                puthelp "NOTICE $user :$nick is regular on this channel and may not be set on ignore"
                return
        }

        chattr $nick |+L $channel

        puthelp "NOTICE $user :Successfully added $nick as regular on $channel"
        puthelp "NOTICE $nick :You have been added as regular on $channel and will get autovoice from now on"


}
proc css_join {nick uhost hand chan} {
        if {[matchattr $nick |r $chan]} {
                putlog "Regular join"
                putserv "MODE $chan +v $nick"
        } else {
                putlog "New join"
                css_greet $nick $chan
        }
}
putlog "Loaded CSS 1.2"