SHOW:
|
|
- or go back to the newest paste.
| 1 | ### PBinSrc.tcl 1.0.0 fMrtKqyq | |
| 2 | ||
| 3 | #LICENSE | |
| 4 | # Copyright © 2013 Alberto Dietze "DoctorD90" | |
| 5 | # | |
| 6 | # This program is free software: you can redistribute it and/or modify | |
| 7 | # it under the terms of the GNU General Public License as published by | |
| 8 | # the Free Software Foundation, either version 3 of the License, or | |
| 9 | # (at your option) any later version. | |
| 10 | # | |
| 11 | # This program is distributed in the hope that it will be useful, | |
| 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 | # GNU General Public License for more details. | |
| 15 | # | |
| 16 | # You should have received a copy of the GNU General Public License | |
| 17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| 18 | # | |
| 19 | # Full GPLv3 Text: http://www.gnu.org/licenses/gpl.txt | |
| 20 | ||
| 21 | #PATERNITY | |
| 22 | #Coder: DoctorD90 | |
| 23 | #Network: irc.OnlineGamesNet.net | |
| 24 | #Chan: #eHito | |
| 25 | #Mail: [email protected] | |
| 26 | # | |
| 27 | #Thanks to guys on #egghelp on irc.freenode.net | |
| 28 | ||
| 29 | #PURPOSE | |
| 30 | #Keep update all scripts made by me. | |
| 31 | ||
| 32 | #USAGE | |
| 33 | #Add this script to your eggdrop's list to load it. | |
| 34 | ||
| 35 | ||
| 36 | ### DON'T EDIT ANYTHING BELOW ### | |
| 37 | ||
| 38 | package require http | |
| 39 | ||
| 40 | set PBinSrc 1 | |
| 41 | ||
| 42 | proc pbinsrc_vchk {v1 v2} {
| |
| 43 | set v11 [lindex $v1 0] | |
| 44 | set v12 [lindex $v1 1] | |
| 45 | set v13 [lindex $v1 2] | |
| 46 | set v21 [lindex $v2 0] | |
| 47 | set v22 [lindex $v2 1] | |
| 48 | set v23 [lindex $v2 2] | |
| 49 | set v 1 | |
| 50 | if {$v11 > $v21} {set v "0"}
| |
| 51 | if {$v && $v12 > $v22} {set v "0"}
| |
| 52 | if {$v && $v13 >= $v23} {set v "0"}
| |
| 53 | return $v | |
| 54 | } | |
| 55 | ||
| 56 | bind pub n .pbinupd pub_pbinupd | |
| 57 | proc pub_pbinupd {nick uhost hand chan text} {
| |
| 58 | if {![string length [string trim $text]} {
| |
| 59 | notice $nick "Script Name Required." | |
| 60 | return | |
| 61 | } | |
| 62 | set scr [lindex [split $text] 0] | |
| 63 | if {![file exists "scripts/$scr"]} {
| |
| 64 | notice $nick "Script Doesn't Exist In Script's Folder." | |
| 65 | return | |
| 66 | } | |
| 67 | set fs [open "scripts/$scr"] | |
| 68 | set lines [split [read -nonewline $fs] "\n"] | |
| 69 | close $fs | |
| 70 | set v1 [split [lindex [split [lindex $lines 0]] end-1] "."] | |
| 71 | set link [lindex [split [lindex $lines 0]] end] | |
| 72 | set code [http::data [set Token [http::geturl "http://pastebin.com/raw.php?i=$link"]]] | |
| 73 | http::cleanup $Token | |
| 74 | set v2 [split [lindex [split [lindex [split $code "\n"] 0]] end-1] "."] | |
| 75 | if {![pbinsrc_vchk $v1 $v2]} {
| |
| 76 | notice $nick "\002$scr\002 Yet Latest Version Available." | |
| 77 | return | |
| 78 | } | |
| 79 | set fs [open "scripts/$scr" w] | |
| 80 | puts $fs $code | |
| 81 | close $fs | |
| 82 | notoce $nick "\002$scr\002 Successfully Updated." | |
| 83 | rehash | |
| 84 | } | |
| 85 | ||
| 86 | ||
| 87 | bind pub n .pbindwl pub_pbindwl | |
| 88 | proc pub_pbindwl {nick uhost hand chan text} {
| |
| 89 | if {![string length [string trim $text]} {
| |
| 90 | notice $nick "Script Name Required." | |
| 91 | return | |
| 92 | } | |
| 93 | set pbincheck [regexp -all -nocase {(pastebin.com/[\d\w-]{8})} $text pbinid]
| |
| 94 | set code [split [http::data [set Token [http::geturl "http://pastebin.com/raw.php?i=[lindex [split $pbinid /] 1]"]]] "\n"] | |
| 95 | http::cleanup $Token | |
| 96 | set scr [lindex [split [lindex $code 0]] 2] | |
| 97 | set fs [open "scripts/$scr" w] | |
| 98 | puts $fs $code | |
| 99 | close $fs | |
| 100 | privmsg $nick "Successfully Downloaded." | |
| 101 | # | |
| 102 | #DownLoad Requirements WiP | |
| 103 | set l [expr {[lsearch $code "#REQUIREMENTS"] != "-1"] + 1}]
| |
| 104 | if {!$l} {return}
| |
| 105 | set a 1 | |
| 106 | while {$a} {
| |
| 107 | if {![string length [string trim [lindex $code $l]]]} {
| |
| 108 | set a 0 | |
| 109 | } else {
| |
| 110 | lappend req [lindex [split [lindex $code $l]] 2] | |
| 111 | incr l | |
| 112 | } | |
| 113 | } | |
| 114 | #download | |
| 115 | } | |
| 116 | ||
| 117 | ### | |
| 118 | - | putlog "PBinScr.tcl LOADED" |
| 118 | + | putlog "PBinSrc.tcl LOADED" |