AlphaTech Voice
Joined: 23 Jul 2014 Posts: 12 Location: New York, USA
|
Posted: Mon May 11, 2015 3:55 pm Post subject: Pastebin and Link Shorteners |
|
|
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: |
proc pastebin_t t {return [exec echo $t | nc termbin.com 9999]}
|
Example:
| Code: |
bind pub - !paste paste
proc paste {n u h c t} {putserv "PRIVMSG $c :[pastebin_t $t]"}
|
pastebin_f: Pastes Given File
| Code: |
proc pastebin_f f {return [exec cat $f | nc termbin.com 9999]}
|
Example:
| Code: |
set file "/home/user/botdir/file.txt"
putserv "PRIVMSG #channel :[pastebin_f $file]"
|
tinyurl: Returns a TinyURL of a given link
| Code: |
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: |
bind pubm - "% !tinyurl *" cmd_tinyurl
proc cmd_tinyurl {n u h c t} {
putquick "PRIVMSG $c :[tinyurl [lindex [split $t] 1 ]]"
}
|
|
|