# Author: tomekk # e-mail: tomekk/@/oswiecim/./eu/./org # home page: http://tomekk.oswiecim.eu.org/ # # Version 0.1 # # This file is Copyrighted under the GNU Public License. # http://www.gnu.org/copyleft/gpl.html # channels for !fmylife set fmylife_channels {#chan1 #chan2} # time between use !fmylife (seconds) set fmylife_reuse_time 20 ########################################################### bind pub - !fmylife fm_main_proc package require http proc get_fmylife { } { set f_http_uagent "Opera/9.61 (Windows i686; U; en) Presto/2.1.1" set f_http_token [http::config -useragent $f_http_uagent] if {[catch {set f_http_token [::http::geturl "http://www.fmylife.com/random" -timeout 10000]}]} { return "error" } { return [http::data $f_http_token] } } set fmylife_reuse 1 proc fm_main_proc { nick uhost hand chan arg } { global fmylife_channels fmylife_reuse fmylife_reuse_time if {[expr [clock seconds] - $fmylife_reuse] <= $fmylife_reuse_time} { putquick "PRIVMSG $chan :$nick: to fast, sorry" return } if {[lsearch $fmylife_channels $chan] == -1} { return } set fm_quote "" set fm_link "" set fm_quote [get_fmylife] if {($fm_quote == "error") || ($fm_quote == "")} { putquick "PRIVMSG $chan :problem with connection, try again later, sorry" return } regsub -all -nocase "\n" $fm_quote "" fm_quote regsub -all -nocase "\r" $fm_quote "" fm_quote regsub -all -nocase "\t" $fm_quote "" fm_quote # 1st quote regsub -nocase {.*
(.+)