| View previous topic :: View next topic |
| Author |
Message |
SL0RD Voice
Joined: 05 Oct 2008 Posts: 19
|
Posted: Sat Jan 16, 2010 12:28 am Post subject: URL Shortener |
|
|
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 |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sat Jan 16, 2010 8:17 am Post subject: |
|
|
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 |
|
 |
SL0RD Voice
Joined: 05 Oct 2008 Posts: 19
|
Posted: Sat Jan 16, 2010 8:47 am Post subject: |
|
|
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 |
|
 |
SL0RD Voice
Joined: 05 Oct 2008 Posts: 19
|
Posted: Sat Jan 16, 2010 9:39 am Post subject: |
|
|
| nevermind, i got it working. turns out i typoed the url lol thanks for the help |
|
| Back to top |
|
 |
|