DoctorD90 icon

Adfly.tcl

DoctorD90 | PRO | 05/07/13 05:36:50 PM UTC | 0 ⭐ | 352 👁️ | Never ⏰ | []
TCL |

3.09 KB

|

None

|

0 👍

/

0 👎

### Adfly.tcl 1.8.1 gD6AWkhd
 
#REQUIREMENTS
# WebPFix.tcl mNct0SYj
 
#SUGGESTED
# PBinSrc.tcl fMrtKqyq
# TCLLoader.tcl smApj15u
 
#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 <http://www.gnu.org/licenses/>.
#
# Full GPLv3 Text: http://www.gnu.org/licenses/gpl.txt
 
#PATERNITY
#Coder: DoctorD90
#Network: irc.OnlineGamesNet.net
#Chan: #eHito
#Mail: [email protected]
#Script's List: www.EggTcl.tk
 
#PURPOSE
#Allow use of Adfly system trougth eggdrop.
 
#USAGE
#Use commands that you set in SETTINGS section.
 
#SETTINGS
#Get next 2 settings from link that you get from Adfly Personal Page.
set adfly(key) "&&&&&&&&&&&&&&"
set adfly(uid) "0000000"
#Set default domain: 0=adf.ly | 1=q.gs
set adfly(dmn) "0"
#Set default type: 0=Banner | 1=Interstitial
set adfly(typ) "0"
#Allow NOT shrinked links in cases of returned errors.
set adfly(err) "1"
#Set flag of people can use public command.
set adfly(pflag) "-"
#Set flag of allowed people to use query command.
set adfly(qflag) "-"
#Set public command to shrink links.
set adfly(padd) ".Shrink"
#Set query command to shrink links.
set adfly(qadd) ".Shrink"
 
 
### DON'T EDIT ANYTHING BELOW ###
 
package require html
 
proc adfly {link {dmn ""} {typ ""}} {
  if {![string length [string trim $dmn]]} {
    set dmn "$::adfly(dmn)"
  }
  if {$dmn == "0"} {
    set dmn "adf.ly"
  } else {
    set dmn "q.gs"
  }
  if {![string length [string trim $typ]]} {
    set typ "$::adfly(typ)"
  }
  if {$typ == "0"} {
    set ads0 "banner"
    set ads1 "banner/"
  } else {
    set ads0 "int"
    set ads1 ""
  }
  set link [webpfix_adder $link]
  set plink "http://api.adf.ly/api.php?key=${::adfly(key)}&uid=${::adfly(uid)}&advert_type=${ads0}&domain=${dmn}&url=${link}"
  set code [lindex [split [http::data [set Token [http::geturl "$plink" -timeout "30000"]]]] 0]
  http::cleanup $Token
  if {[string tolower $code] == "error" && $::adfly(err)} {
    set code "http://adf.ly/${::adfly(uid)}/${ads1}$link"
  }
  return $code
}
 
bind pub $adfly(pflag) $adfly(padd) pub_adfly
proc pub_adfly {nick uhost hand chan text} {
  msg_adfly $nick $uhost $hand $text
}
 
bind msg $adfly(qflag) $adfly(qadd) msg_adfly
proc msg_adfly {nick uhost hand text} {
  if {![string length [string length $text]]} {
    putserv "NOTICE $nick :\002Shrinker:\002 Link required."
    return
  }
  set link [adfly [lindex [split $text] 0]]
  putserv "NOTICE $nick :\002Shrinker:\002 $link"
}
 
###
putlog "Adfly.tcl LOADED"

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎