All pastes #543427 Raw Edit

Mine

public text v1 · immutable
·published 2007-06-06 02:28 UTC
rendered paste body
#Respuestas v1.0 by G.L.A
package require http
set agent "Mozilla"


bind pub - !decime tedigo
bind pub - hola hola
bind pub - buenas buenas
bind pub - !sarcasmo sarcasmo




proc tedigo {nick uhost hand chan arg} {


 global agent
	if {[llength $arg]==0} {
		
	} else {
		set query "http://www.google.com.ar/search?btnI=&q="
		for { set index 0 } { $index<[llength $arg] } { incr index } {
			set query "$query[lindex $arg $index]"
			if {$index<[llength $arg]-1} then {
				set query "$query+"
			}
		}
		#putserv "PRIVMSG $channel :$query"
                set token [http::config -useragent $agent]
		set token [http::geturl $query]
		puts stderr ""
		upvar #0 $token state
		set max 0
		foreach {name value} $state(meta) {
			if {[regexp -nocase ^location$ $name]} {
				set newurl [string trim $value]
			}
		}
	}







  if {[lindex $arg 0] != ""} {
    set partes [split $arg " "]
    set pregunta [lindex $partes 0]

    switch -exact -- $pregunta { 
    web {putserv "PRIVMSG $chan :\002$pregunta\002 -> http://gnulinuxargentina.com.ar"} 
    foro {putserv "PRIVMSG $chan :\002$pregunta\002 -> http://gnulinuxargentina.com.ar/foro/index.php" } 
    wiki {putserv "PRIVMSG $chan :\002$pregunta\002 -> http://www.gnulinuxargentina.com.ar/wiki/index.php/Portada"} 
    puto {putserv "PRIVMSG $chan :\002$pregunta\002!!!, yo te digo, pero me parece raro que te guste que te digan asi"}
    
#Agregas las respuestas estaticas asi:
# >pregunta> {putserv "PRIVMSG $chan :\002$pregunta\002 -> <respuesta>"}

    default {putserv "PRIVMSG $chan :No se de que me hablas pero google si ---> $newurl"}


 } } else {
    	putserv "PRIVMSG $nick Ayuda:"
	putserv "PRIVMSG $nick : !decime wiki"
	putserv "PRIVMSG $nick : !decime foro"
	putserv "PRIVMSG $nick : !decime  web"
#Y tenes que agregar aca la ayuda
         }
}


proc hola {nick uhost hand chan arg} {
putserv "PRIVMSG $chan :Hola manola, digo hola $nick" 
}

proc buenas {nick uhost hand chan arg} {
putserv "PRIVMSG $chan :como va $nick ?" 
}

proc sarcasmo {nick uhost hand chan arg} {
  if {[lindex $arg 0] != ""} {
    set partes [split $arg " "]
    set pregunta [lindex $partes 0]

    putserv "PRIVMSG $chan :<sarcasmo>$pregunta</sarcasmo>"



  } else {
    	putserv "PRIVMSG $nick : Ayuda:"
	putserv "PRIVMSG $nick : !sarcasmo <mensaje sarcastico>"

  }


}