### PBin2TclH.tcl 1.4.0 ME5hHLZn #SUGGESTED # PBinSrc.tcl fMrtKqyq # TCLLoader.tcl smApj15u #LICENSE # Copyright © 2012 - 2013 Alberto Dietze "DoctorD90" # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Full GPLv3 Text: http://www.gnu.org/licenses/gpl.txt #PATERNITY #Coder: DoctorD90 #Network: irc.OnlineGamesNet.net #Chan: #eHito #Mail: DoctorD90@EggTcl.tk #Script's List: www.EggTcl.tk # #Thanks to guys on #egghelp on irc.freenode.net #Special thanks to Thommey #PURPOSE #Transfering text from pastebin.com to tclhelp.net. #USAGE #Write pastebin.com's urls in chan or query, and #bot will give back the paste.tclhelp.net's urls. #Bot will detect links automatically or trougth a command #according with settings. #SETTINGS #Set how script detects pastebin.com's urls; #0: Automatically, in all line; 1: Cmds; set pb2tclh(ai) "0" #Set flag of allowed people to use script in chan. set pb2tclh(pflag) "-" #Set flag of allowed people to use script in query. set pb2tclh(qflag) "-" #Set public command to detects pastebin.com's urls. set pb2tclh(pcmd) "!pastebin" #Set query command to detects pastebin.com's urls. set pb2tclh(qcmd) ".pastebin" ### DON'T EDIT ANYTHING BELOW ### package require http if {[string is integer -strict $pb2tclh(ai) && $pb2tclh(ai) >= "0" && $pb2tclh(ai) < "2"} { if {$pb2tclh(ai) == "0"} { set pb2tclh(pchk) "*pastebin.com/*" set pb2tclh(qchk) "*pastebin.com/*" } if {$pb2tclh(ai) == "1"} { set pb2tclh(pchk) "$pb2tclh(pcmd) *pastebin.com/*" set pb2tclh(qchk) "$pb2tclh(qcmd) *pastebin.com/*" } } else { putlog "PBin2TclH.tcl ERROR: Wrong detecting setting." } bind pubm $pb2tclh(pflag) $pb2tclh(qchk) pubm_pb2tclh proc pubm_pb2tclh {nick uhost hand chan text} { pb2tclh_paster $chan $text } bind msgm $pb2tclh(qflag) $pb2tclh(qchk) msgm_pb2tclh proc msgm_pb2tclh {nick uhost hand text} { pb2tclh_paster $chan $text } proc pb2tclh_paster {target text} { set ids [lsearch -all -nocase -inline [split $text] "*pastebin.com/*" ] if {![string length $ids]} {return} foreach pbinid [split $ids] { if {[regexp -nocase {(pastebin.com/[\d\w-]{8})} $pbinid link]} { set code [http::data [set Token [http::geturl "http://pastebin.com/raw.php?i=[lindex [split $link /] end]" -timeout "30000"]]] http::cleanup $Token set sid [socket tclhelp.net 55555] fconfigure $sid -buffering line puts $sid $code gets $sid gets $sid gets $sid url close $sid putserv "PRIVMSG $target :http://$link => $url" } } } ### putlog "PBin2TclH.tcl LOADED"