All pastes #631476 Raw Edit

Princesse

public text v1 · immutable
#631476 ·published 2007-07-24 00:14 UTC
rendered paste body
######################################
# Away.tcl by KuNgFo0 (www.eggfaq.com)
set away_version "0.4"

#DESCRIPTION At random intervals, sets the bot away/back and sends an away message to the set channels.

#CHANGELOG
# V0.4	ToM
#	Reindente code. Rewrote the onload putlog. Renamed conf vars to away_cfg(var).
#	Added a public channels configuration
#	Added a "putserv away" on init so the bot returns from away on rehash.

# Set the next line if you want to display public away/back messages [0/1]
set away_cfg(public) 1
# Set the channels where the bot tells he's away
set away_cfg(publicchans) "#max128 #Sun`Night"

# Set the next line as the maximum minute interval between away/back
set away_cfg(awaymaxtime) 90
# Set the next list as the away messages you want
set away_cfg(awaymsgs) { 
        "Je suis away et comme toujours je fait rien"
	"Parti réinstaller windows après avoir fait Format C: oups :p"
        "Je cherche mon troll fruitopia :)"
        "Je cherche des pv hotttt"
        "Parti jouer au uno avec _Zup63 et Max128 :p"
        "Awayyy ses tout"
        "Je me cherche une partenaire robot"
     	"Parti a l'eglise et puis quoi ?"
        "Parti aller rendre visite a mon troll preféré"
        "c'est l'heure de se bourrer !!!!"
        "Parti faire une grosse sieste hihihhi :p"
        "Chutttt je suis AWAYYYYYYY"
        "Je suis parti me faire masser hummm"
        "héhéhé je suis un québecois je vais aller profiter :p"
        "Parti draguer tout ce qui bouge !!!!"
        "Je me fait bronzer !!!"
        "Parti attaquer le frigo attention me voila !!"
         }


## end config



proc time_away {} {
	global away_cfg away_status
	if {$away_status(isaway)} {
		if {$away_cfg(public)} {
			foreach chan [channels] {

				# chan auth
    			if {$away_cfg(publicchans) != ""} {
					if {[lsearch -exact [split $away_cfg(publicchans)] [string tolower $chan]] != -1} {
			    		puthelp "PRIVMSG $chan :\001ACTION est \002Revenu:\002 $away_status(msg) - \002Parti:\002 [expr ([clock seconds] - $away_status(gonetime)) / 60] minutes\001"
			    	}
			    }

			}
		}
		putserv "AWAY"
		set away_status(isaway) 0
	} else {
		set away_status(msg) [lindex $away_cfg(awaymsgs) [rand [llength $away_cfg(awaymsgs)]]]
		if {$away_cfg(public)} {
			foreach chan [channels] {

				# chan auth
    			if {$away_cfg(publicchans) != ""} {
					if {[lsearch -exact [split $away_cfg(publicchans)] [string tolower $chan]] != -1} {
						puthelp "PRIVMSG $chan :\001ACTION est \002Parti:\002 $away_status(msg)\001"
			    	}
			    }

			}
		}
		putserv "AWAY :$away_status(msg)"
		set away_status(isaway) 1
		set away_status(gonetime) [clock seconds]
	}
	if {![string match "*time_away*" [timers]]} {
		timer [expr [rand $away_cfg(awaymaxtime)] + 1] time_away
	}
}

# Init
putserv "AWAY"
set away_status(isaway) 0
set away_status(msg)  ""
set away_status(gonetime) 0
if {![string match "*time_away*" [timers]]} {
	timer [expr [rand $away_cfg(awaymaxtime)] + 1] time_away
}

putlog "[bold]Away.tcl[bold] v$away_version by KuNgFo0 mod ToM loaded"