This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

URL Shortener

Help for those learning Tcl or writing their own scripts.
Post Reply
S
SL0RD
Voice
Posts: 19
Joined: Sun Oct 05, 2008 11:44 am

URL Shortener

Post by SL0RD »

Hi, I am having trouble getting my bot to work with my URL shortener API. I've been trying to use curl to shorten a url from the channel, but i don't know how to get teh shortened url so the bot can output it in the channel. Also i can't get the bot to actually shorten the url, it keeps saying error. any help would be greatly appreciated. Here is what i have so far.

Code: Select all

bind pub - !miut miut:trim

proc miut:trim { nick host hand chan text } {
        set url $text
        if {[catch {exec /usr/bin/curl -d url=$url http://muit.me/api.php?} result]} {
                puthelp "PRIVMSG $chan :Error!"
        } else {
                puthelp "PRIVMSG $chan :It worked!"
        }
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

A good start would be to print the actual content of $result once you've done your call to exec, as this will hold either the error reason, or the result from curl.
NML_375
S
SL0RD
Voice
Posts: 19
Joined: Sun Oct 05, 2008 11:44 am

Post by SL0RD »

ok so i just added $result at in the error like that outputs to the channel and all it said was this;

Error; % Total % Received % Xferd Average Speed Time Time Time Current

Code: Select all

bind pub - !miut miut:trim

proc miut:trim { nick host hand chan text } {
        set url $text
        if {[catch {exec /usr/bin/curl -d url=$url http://muit.me/api.php?} result]} {
                puthelp "PRIVMSG $chan :Error; $result"
        } else {
                puthelp "PRIVMSG $chan :It worked!"
        }
}
S
SL0RD
Voice
Posts: 19
Joined: Sun Oct 05, 2008 11:44 am

Post by SL0RD »

nevermind, i got it working. turns out i typoed the url lol thanks for the help
Post Reply