| View previous topic :: View next topic |
| Author |
Message |
LiquidIce Halfop
Joined: 09 Jan 2004 Posts: 48 Location: USA
|
Posted: Fri Dec 09, 2005 8:31 pm Post subject: reading from a website |
|
|
| Is it possible to read a script from a website. Such as unreal ircd has remote includes function. can this be done by the bot or no? |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Sat Dec 10, 2005 1:31 am Post subject: |
|
|
yes
see any autoupdated script, for example spambuster _________________ connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code |
|
| Back to top |
|
 |
LiquidIce Halfop
Joined: 09 Jan 2004 Posts: 48 Location: USA
|
|
| Back to top |
|
 |
De Kus Revered One

Joined: 15 Dec 2002 Posts: 1361 Location: Germany
|
Posted: Sun Dec 11, 2005 12:42 am Post subject: |
|
|
not directly, but you could use http::geturl to get the script and eval its content.
| Code: | package require http 2.4
::http::geturl {http://blah.net/somescript.tcl} -command httploadscript
proc httploadscript {token} {
if {[::http::ncode $token] == 200} {
uplevel #0 [::http::data $token]
} else {
putlog "Failed to load file from website: [::http::error $token]"
}
::http::cleanup $token
return 0
} |
use at your own risk, since if the content of the site changes and contains some bad code, someone might be able to takeover your bot.
Also note that the script will be loaded asyncron, meaning it will most likely be loaded at last (so put all source commands that require that script to be already loaded after the eval line).
Edit: eval -> uplevel like demond mentioned. _________________ De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
Last edited by De Kus on Sun Jan 08, 2006 10:25 am; edited 1 time in total |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Sun Dec 11, 2005 3:37 am Post subject: |
|
|
| De Kus wrote: |
| Code: |
eval [::http::data $token]
|
|
that won't work as intended, you are evaluating in a proc, not in the global context in which that script most likely expects to be evaluated; use [uplevel] _________________ connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code |
|
| Back to top |
|
 |
|