I am looking at this script here... https://code.google.com/p/crappy-irc-bo ... 3ab1791b42
Any shot that can easily be moved over (and work) as a tcl file for an eggdrop?
Code: Select all
# e-mail: tomekk/@/tomekk/./org
# home page: http://tomekk.org/
#
# Version 0.1
#
# This file is Copyrighted under the GNU Public License.
# http://www.gnu.org/copyleft/gpl.html
###########################################################
bind pub - !fw fweather
package require tdom
package require http
proc fweather { nick uhost hand chan arg } {
set arg [string trim $arg]
if {$arg != ""} {
set f_url "http://thefuckingweather.com/?where=$arg"
regsub -all {\s} $f_url "+" f_url
set f_fake_ua "Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Firefox/24.0"
set f_token [http::config -useragent $f_fake_ua]
if {[catch {set f_token [::http::geturl $f_url -timeout 10000]}]} {
putquick "PRIVMSG $chan :Error retrieving [censored] weather data!"
} else {
set f_data [[dom parse -html [http::data $f_token]] getElementsByTagName span]
foreach f_loc_temp $f_data {
set location_data [string trim [$f_loc_temp asText]]
if {$location_data != ""} {
if {[regexp {^([0-9]+)$} $location_data]} {
set location_data "${location_data}°"
}
putquick "PRIVMSG $chan :$location_data"
} else {
putquick "PRIVMSG $chan :location: $arg not found"
}
}
}
} else {
putquick "PRIVMSG $chan :use: !fw <location>"
}
}
putlog "fweather.tcl ver 0.1 by tomekk loaded"
Code: Select all
me@me:~/eggdrop/$ tclsh
% package require tdom
0.8.3
% exit
Code: Select all
[11:18:14] Tcl error in file 'eggdrop.conf':
[11:18:14] can't find package tdom
while executing
"package require tdom"
(file "scripts/fweather.tcl" line 12)
invoked from within
"source scripts/fweather.tcl"
(file "eggdrop.conf" line 1405)
[11:18:14] * CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)