### PBinSrc.tcl 1.0.0 fMrtKqyq #LICENSE # Copyright © 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 # #Thanks to guys on #egghelp on irc.freenode.net #PURPOSE #Keep update all scripts made by me. #USAGE #Add this script to your eggdrop's list to load it. ### DON'T EDIT ANYTHING BELOW ### package require http set PBinSrc 1 proc pbinsrc_vchk {v1 v2} { set v11 [lindex $v1 0] set v12 [lindex $v1 1] set v13 [lindex $v1 2] set v21 [lindex $v2 0] set v22 [lindex $v2 1] set v23 [lindex $v2 2] set v 1 if {$v11 > $v21} {set v "0"} if {$v && $v12 > $v22} {set v "0"} if {$v && $v13 >= $v23} {set v "0"} return $v } bind pub n .pbinupd pub_pbinupd proc pub_pbinupd {nick uhost hand chan text} { if {![string length [string trim $text]} { notice $nick "Script Name Required." return } set scr [lindex [split $text] 0] if {![file exists "scripts/$scr"]} { notice $nick "Script Doesn't Exist In Script's Folder." return } set fs [open "scripts/$scr"] set lines [split [read -nonewline $fs] "\n"] close $fs set v1 [split [lindex [split [lindex $lines 0]] end-1] "."] set link [lindex [split [lindex $lines 0]] end] set code [http::data [set Token [http::geturl "http://pastebin.com/raw.php?i=$link"]]] http::cleanup $Token set v2 [split [lindex [split [lindex [split $code "\n"] 0]] end-1] "."] if {![pbinsrc_vchk $v1 $v2]} { notice $nick "\002$scr\002 Yet Latest Version Available." return } set fs [open "scripts/$scr" w] puts $fs $code close $fs notoce $nick "\002$scr\002 Successfully Updated." rehash } bind pub n .pbindwl pub_pbindwl proc pub_pbindwl {nick uhost hand chan text} { if {![string length [string trim $text]} { notice $nick "Script Name Required." return } set pbincheck [regexp -all -nocase {(pastebin.com/[\d\w-]{8})} $text pbinid] set code [split [http::data [set Token [http::geturl "http://pastebin.com/raw.php?i=[lindex [split $pbinid /] 1]"]]] "\n"] http::cleanup $Token set scr [lindex [split [lindex $code 0]] 2] set fs [open "scripts/$scr" w] puts $fs $code close $fs privmsg $nick "Successfully Downloaded." # #DownLoad Requirements WiP set l [expr {[lsearch $code "#REQUIREMENTS"] != "-1"] + 1}] if {!$l} {return} set a 1 while {$a} { if {![string length [string trim [lindex $code $l]]]} { set a 0 } else { lappend req [lindex [split [lindex $code $l]] 2] incr l } } #download } ### putlog "PBinSrc.tcl LOADED"