egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

URL Shortener

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
SL0RD
Voice


Joined: 05 Oct 2008
Posts: 19

PostPosted: Sat Jan 16, 2010 12:28 am    Post subject: URL Shortener Reply with quote

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:

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!"
        }
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sat Jan 16, 2010 8:17 am    Post subject: Reply with quote

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, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
SL0RD
Voice


Joined: 05 Oct 2008
Posts: 19

PostPosted: Sat Jan 16, 2010 8:47 am    Post subject: Reply with quote

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:

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!"
        }
}
Back to top
View user's profile Send private message
SL0RD
Voice


Joined: 05 Oct 2008
Posts: 19

PostPosted: Sat Jan 16, 2010 9:39 am    Post subject: Reply with quote

nevermind, i got it working. turns out i typoed the url lol thanks for the help
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber