Using this script the commands. !update and !clanrank work fine. However the !nextwar brings up this error....
Can anyone help with this, It was working then started with the errors and nothing has been changed ;(
Code: Select all
BUG: ClanBase has changed, make sure your cid and lid settings are correct. If not, e-mail wcc@techmonkeys.org with this data: cbjsWarUpcoming_Start();cbjsWarUpcoming_End();
Code: Select all
##################################################################
## This script gets clan information from www.ClanBase.com and ##
## reports it to a channel when you type a trigger. Information ##
## includes next war and clan rank next war. ##
## ##
## NOTE: The bot will pause briefly during an update. ##
## ##
## Based on code by ppslim. ##
##################################################################
##############
## COMMANDS ##
############################################
## PUB ## !clanrank (Can be changed) ##
######### Shows the current rank and ##
######### points your clan currently has. ##
######### ------------------------------- ##
######### !nextwar (Can be changed) ##
######### Shows information about the ##
######### next war. ##
######### ------------------------------- ##
######### !update (Can be changed) ##
######### Manually updates ClanBase info. ##
############################################
##########################################################
## Just load the script, edit the settings, and rehash. ##
##########################################################
################################################
# Set the flag required to view the info here. #
################################################
set clanbase_setting(flag) "-|-"
##################################
# Set the next-war command here. #
##################################
set clanbase_setting(cmd_nxtwar) "!nextwar"
###################################
# Set the clan rank command here. #
###################################
set clanbase_setting(cmd_crank) "!rank"
################################
# Set the update command here. #
################################
set clanbase_setting(cmd_updt) "!update"
##################################
# Set your League ID (LID) here. #
##################################
set clanbase_setting(lid) "219"
################################
# Set your Clan ID (CID) here. #
################################
set clanbase_setting(cid) "160276"
########################################################################
# How often (In minutes) would you like the information to be updated? #
########################################################################
set clanbase_setting(timer_update) "10"
####################
# Code begins here #
####################
if {![string match 1.6.* $version]} {
putlog "\002CLANBASE:\002 \002CRITICAL ERROR\002 ClanBase.tcl requires eggdrop 1.6.x to run."
die "\002CLANBASE:\002 \002CRITICAL ERROR\002 ClanBase.tcl requires eggdrop 1.6.x to run."
}
if {[info tclversion] < 8.2} {
putlog "\002CLANBASE:\002 \002CRITICAL ERROR\002 ClanBase.tcl requires Tcl 8.2 or above to run."
die "\002CLANBASE:\002 \002CRITICAL ERROR\002 ClanBase.tcl requires Tcl 8.2 or above to run."
}
package require http
bind pub $clanbase_setting(flag) $clanbase_setting(cmd_crank) clanbase_showrank
bind pub $clanbase_setting(flag) $clanbase_setting(cmd_nxtwar) clanbase_shownext
bind pub $clanbase_setting(flag) $clanbase_setting(cmd_updt) clanbase_update
if {![string match *clanbase_time_update* [timers]]} { timer $clanbase_setting(timer_update) clanbase_time_update }
proc clanbase_update {nick uhost hand chan text} {
clanbase_time_update
putserv "PRIVMSG $chan :The ClanBase information has been updated."
}
proc clanbase_time_update {} {
global clanbase_data clanbase_setting
set q [::http::formatQuery wars 1 cid $clanbase_setting(cid) lid $clanbase_setting(lid)]
set q2 [::http::formatQuery cid $clanbase_setting(cid)]
::http::config -useragent "ClanBase.tcl"
set tok [::http::geturl http://www.clanbase.com/claninfo.php -query $q]
if {[::http::ncode $tok] != 200} {
set clanbase_data(rank) 0
} else {
if {[regexp {Rank: (.*) \((.*) points\)} [::http::data $tok] match rank points]} {
set clanbase_data(rank) [list $rank $points [unixtime]]
} else {
set clanbase_data(rank) 0
}
}
set tok2 [::http::geturl http://www.clanbase.com/cbjswarupcoming.php -query $q2]
if {[::http::ncode $tok2] != 200} {
set clanbase_data(nextwar) 0
} else {
regsub -all -- "\"" "[::http::data $tok2]" "" data
regsub -all -- "," "$data" "" data
if {[regexp {cbjsWarUpcoming_Start\(\)\;cbjsWarUpcoming_Each\((.*)\)\;cbjsWarUpcoming_End\(\)\;} $data match data]} { set clanbase_data(nextwar) 0 }
if {[llength $data] < 10} {
set clanbase_data(nextwar) 0
putlog "BUG: ClanBase has changed, make sure your cid and lid settings are correct. If not, e-mail wcc@techmonkeys.org with this data: $data"
} else {
set wid [lindex $data 0]
set with [lindex $data 1]
set time [lindex $data 4]
set date [lindex $data 5]
set game [lindex $data 8]/[lindex $data 9]
set clanbase_data(nextwar) [list $with $time $date $game http://www.clanbase.com/warinfo.php?[::http::formatQuery wid $wid] [unixtime]]
}
}
::http::cleanup $tok
::http::cleanup $tok2
if {![string match *clanbase_time_update* [timers]]} { timer $clanbase_setting(timer_update) clanbase_time_update }
}
proc clanbase_showrank {nick uhost hand chan text} {
global clanbase_data
if {![info exists clanbase_data(rank)]} {
puthelp "PRIVMSG $chan :The information has not been downloaded yet. Please wait until the next update."
} elseif {[string equal $clanbase_data(rank) 0]} {
puthelp "PRIVMSG $chan :An error occurred the last time the information was downloaded. Try again later."
} else {
set ts "[duration [expr [unixtime] - [lindex $clanbase_data(rank) end]]] ago."
puthelp "PRIVMSG $chan :Rank: [lindex $clanbase_data(rank) 0] Points: [lindex $clanbase_data(rank) 1] Updated: $ts"
}
}
proc clanbase_shownext {nick uhost hand chan text} {
global clanbase_data
if {![info exists clanbase_data(nextwar)]} {
puthelp "PRIVMSG $chan :The information has not been downloaded yet. Please wait until the next update."
} elseif {[string equal $clanbase_data(nextwar) 0]} {
puthelp "PRIVMSG $chan :An error occurred the last time the information was downloaded. Try again later."
} else {
set ts "[duration [expr [unixtime] - [lindex $clanbase_data(nextwar) end]]] ago."
puthelp "PRIVMSG $chan :Next War: [lindex $clanbase_data(nextwar) 0], [lindex $clanbase_data(nextwar) 1] [lindex $clanbase_data(nextwar) 2], [lindex $clanbase_data(nextwar) 3]. Details: [lindex $clanbase_data(nextwar) 4] Updated: $ts"
}
}
putlog "\002CLANBASE:\002 ClanBase.tcl Version 1.1 by Wcc is loaded."