| View previous topic :: View next topic |
| Author |
Message |
Salim Voice
Joined: 27 Apr 2008 Posts: 2
|
Posted: Sun Apr 27, 2008 5:46 am Post subject: [SOLVED] Trying to set user variables and download a file. |
|
|
Hey, im trying to make a script which downloads a file depending what the user writes eg. '!stats someone' would get a certain file eg http://server.tld/stats.php?stats=someone. Heres what I got until now and I dont have a clue why it isnt working.
| Code: | package require http
bind pub 0 !stats getfile
proc getfile {nick host hand chan text} {
set user [lindex $text 0]
set x [::http::geturl http://server.tld/stats.php?export=$user]
foreach pasta [split [::http::data $x] \n] {puthelp "privmsg $c :$pasta"}
::http::cleanup $x
} |
Sincerely,
Salim
Last edited by Salim on Sun Apr 27, 2008 12:04 pm; edited 1 time in total |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sun Apr 27, 2008 11:07 am Post subject: |
|
|
Would "someone" happen to contain characters such as {[]}" within it?
First off, you can't use list commands on strings:
| Code: | | set user [lindex $text 0] | really should be | Code: | | set user [lindex [split $text] 0] |
Secondly, I assume you've checked user privileges - that the user issuing the command is properly identified as a user with the +0 flag...
Third, do you get any error messages on your console or such? _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
DragnLord Owner

Joined: 24 Jan 2004 Posts: 711 Location: C'ville, Virginia, USA
|
Posted: Sun Apr 27, 2008 11:52 am Post subject: |
|
|
| having a bind flag of "0" means the person already has to have that flag in the bot's userlist, binds do not automatically give flags |
|
| Back to top |
|
 |
Salim Voice
Joined: 27 Apr 2008 Posts: 2
|
Posted: Sun Apr 27, 2008 12:03 pm Post subject: |
|
|
Changed the line and the flag to '-' and it works now.
Thanks :> |
|
| Back to top |
|
 |
|