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.

Pastebin and Link Shorteners

Help for those learning Tcl or writing their own scripts.
Post Reply
A
AlphaTech
Voice
Posts: 12
Joined: Wed Jul 23, 2014 1:07 am
Location: New York, USA

Pastebin and Link Shorteners

Post by AlphaTech »

These are some functions that I quickly whipped up that can help you easy pastebin and shorten links. These functions can be used in a simple link shortener command, or by a large script running Trivia. Enjoy!

pastebin_t: Pastes Given Text

Code: Select all

proc pastebin_t t {return [exec echo $t | nc termbin.com 9999]}
Example:

Code: Select all

bind pub - !paste paste
proc paste {n u h c t} {putserv "PRIVMSG $c :[pastebin_t $t]"}
pastebin_f: Pastes Given File

Code: Select all

proc pastebin_f f {return [exec cat $f | nc termbin.com 9999]}
Example:

Code: Select all

set file "/home/user/botdir/file.txt"
putserv "PRIVMSG #channel :[pastebin_f $file]"
tinyurl: Returns a TinyURL of a given link

Code: Select all

package require http
proc tinyurl url {
set token [::http::geturl http://tinyurl.com/api-create.php?url=$url]
return [::http::data $token]
::http::cleanup $token
}
Example:

Code: Select all

bind pubm - "% !tinyurl *" cmd_tinyurl
proc cmd_tinyurl {n u h c t} {
putquick "PRIVMSG $c :[tinyurl [lindex [split $t] 1 ]]"
}
Post Reply