Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Caesar's autovoice script with extra features
- #
- #Use .chanset #channel +av to start this script working
- #
- #The bot gives +v to everyone who joins the channel.
- #
- #Public commands: !voice nick1 nick2 nick3 and !devoice nick1 nick2 nick3...
- #
- #
- #- If a user devoiced and he parts the channel and joins again the bot dosen't give the +v only if the pre-defined time (set duration) passed. Time is in seconds.
- #- If the devoiced user changes his nick to gain +v the bot dosen't give the +v only if the pre-defined time (set duration) passed. Time is in seconds
- #
- #
- #See: http://forum.egghelp.org/viewtopic.php?p=106589#106589
- #
- #This script is useful on those channels where +m mode is set. Users can be Easily and effectivly be muted.
- #
- #
- namespace eval av {
- #How long do you want to mute the user (in seconds)?
- set duration 300
- #Use .chanset #channel +av to start this script working
- setudef flag av
- array set ignoreList {}
- bind join * * [namespace current]::joining
- bind pub o !voice [namespace current]::voice
- bind pub o !devoice [namespace current]::devoice
- bind mode - "% +v" [namespace current]::mcVoice
- bind mode - "% -v" [namespace current]::mcDevoice
- bind cron - {*/1 * * * *} [namespace current]::reset
- proc joining {nick uhost hand chan} {
- variable ignoreList
- if {![channel get $chan av] || [isbotnick $nick] || ![botisop $chan]} return
- if {[array get ignoreList $chan] != {}} {
- if {[lsearch -nocase [dict keys [join $ignoreList($chan)]] $uhost] != -1} return
- }
- puthelp "MODE $chan +v $nick"
- }
- proc voice {nick uhost hand chan text} {
- variable ignoreList
- if {![channel get $chan av] || ![botisop $chan] || ![llength $text]} return
- foreach user [split $text] {
- if {[isbotnick $user] || ![onchan $user $chan] || [isvoice $user $chan]} continue
- lappend voiceList $user
- }
- if {[info exists voiceList]} {
- push $chan "+" $voiceList
- }
- }
- proc devoice {nick uhost hand chan text} {
- if {![channel get $chan av] || ![botisop $chan] || ![llength $text]} return
- foreach user [split $text] {
- if {[isbotnick $user] || ![onchan $user $chan] || ![isvoice $user $chan]} continue
- lappend voiceList $user
- }
- if {[info exists voiceList]} {
- push $chan "-" $voiceList
- }
- }
- proc push {chan mc userList} {
- set max 6
- set len [llength $userList]
- while {$len > 0} {
- if {$len > $max} {
- set mode [string repeat "v" $max]
- set users [join [lrange $userList 0 [expr {$max - 1}]]]
- set userList [lrange $userList $max end]
- incr len -$max
- } else {
- set mode [string repeat "v" $len]
- set users [join $userList]
- set len 0
- }
- puthelp "MODE $chan $mc$mode $users"
- }
- }
- proc mcVoice {nick uhost hand chan mc target} {
- variable ignoreList
- if {![channel get $chan av] || ![botisop $chan]} return
- if {[array get ignoreList $chan] != {}} {
- set pos [lsearch -nocase [dict keys [join $ignoreList($chan)]] [getchanhost $target $chan]]
- if {$pos >= 0} {
- set ignoreList($chan) [lreplace $ignoreList($chan) $pos $pos]
- }
- }
- }
- proc mcDevoice {nick uhost hand chan mc target} {
- variable ignoreList
- if {![channel get $chan av] || ![botisop $chan]} return
- set now [clock seconds]
- set uhost [getchanhost $target $chan]
- if {[array get ignoreList $chan] != {}} {
- set pos [lsearch -nocase [dict keys [join $ignoreList($chan)]] $uhost]
- if {$pos >=0 } {
- set ignoreList($chan) [lreplace $ignoreList($chan) $pos $pos [list $uhost $now]]
- return
- }
- }
- lappend ignoreList($chan) [list $uhost $now]
- }
- proc reset {min hour day month weekday} {
- variable ignoreList
- variable duration
- set now [clock seconds]
- foreach chan [channels] {
- if {![channel get $chan av]} {
- if {[array get ignoreList $chan] != {}} {
- array unset ignoreList $chan
- }
- continue
- }
- if {[array get ignoreList $chan] != {}} {
- set x 0
- foreach time [dict values [join $ignoreList($chan)]] {
- if {($now - $time) >= $duration} {
- set ignoreList($chan) [lreplace $ignoreList($chan) $x $x]
- incr x
- }
- }
- }
- }
- }
- }
- putlog "\002Caesar's autovoice script has been successfully LOADED!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement