DoctorD90

PBin2TclH.tcl 1.3.0

May 10th, 2013
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
TCL 2.15 KB | None | 0 0
  1. ### PBin2TclH.tcl 1.3.0 ME5hHLZn
  2.  
  3. #SUGGESTED
  4. # PBinSrc.tcl fMrtKqyq
  5. # TCLLoader.tcl smApj15u
  6.  
  7. #LICENSE
  8. # Copyright © 2012 - 2013 Alberto Dietze "DoctorD90"
  9. #
  10. #    This program is free software: you can redistribute it and/or modify
  11. #    it under the terms of the GNU General Public License as published by
  12. #    the Free Software Foundation, either version 3 of the License, or
  13. #    (at your option) any later version.
  14. #
  15. #    This program is distributed in the hope that it will be useful,
  16. #    but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18. #    GNU General Public License for more details.
  19. #
  20. #    You should have received a copy of the GNU General Public License
  21. #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
  22. #
  23. # Full GPLv3 Text: http://www.gnu.org/licenses/gpl.txt
  24.  
  25. #PATERNITY
  26. #Coder: DoctorD90
  27. #Network: irc.OnlineGamesNet.net
  28. #Chan: #eHito
  29. #Script's List: www.EggTcl.tk
  30. #
  31. #Thanks to guys on #egghelp on irc.freenode.net
  32. #Special thanks to Thommey
  33.  
  34. #PURPOSE
  35. #Transfering text from pastebin.com to tclhelp.net.
  36.  
  37. #USAGE
  38. #Write a pastebin.com url in chan, and bot will give back a Paste.tclhelp.net url
  39.  
  40. #SETTINGS
  41. #Set flag of allowed people to use this script.
  42. set pb2tclh(pflag) "-"
  43.  
  44.  
  45. ### DON'T EDIT ANYTHING BELOW ###
  46.  
  47. package require http
  48.  
  49. bind pubm $pb2tclh(pflag) "*pastebin.com/*" pubm_pb2tclh
  50.  
  51. proc pubm_pb2tclh {nick uhost hand chan text} {
  52.   set ids [lsearch -all -nocase -inline [split $text] "*pastebin.com/*" ]
  53.   if {![string length $ids]} {return}
  54.   foreach pbinid [split $ids] {
  55.     if {[regexp -nocase {(pastebin.com/[\d\w-]{8})} $pbinid link]} {
  56.       set code [http::data [set Token [http::geturl "http://pastebin.com/raw.php?i=[lindex [split $link /] end]" -timeout "30000"]]]
  57.       http::cleanup $Token
  58.       set sid [socket tclhelp.net 55555]
  59.       fconfigure $sid -buffering line
  60.       puts $sid $code
  61.       gets $sid
  62.       gets $sid
  63.       gets $sid url
  64.       close $sid
  65.       putserv "PRIVMSG $chan :http://$link => $url"
  66.     }
  67.   }
  68. }
  69.  
  70. ###
  71. putlog "PBin2TclH.tcl LOADED"
Advertisement