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 

Pastebin and Link Shorteners

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


Joined: 23 Jul 2014
Posts: 12
Location: New York, USA

PostPosted: Mon May 11, 2015 3:55 pm    Post subject: Pastebin and Link Shorteners Reply with quote

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 ]]"
}
Back to top
View user's profile Send private message Send e-mail
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