egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[SOLVED] bit.ly or another one

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
Fire-Fox
Master


Joined: 23 Sep 2006
Posts: 270
Location: /dev/null

PostPosted: Sun May 27, 2012 8:04 pm    Post subject: [SOLVED] bit.ly or another one Reply with quote

Hey!

Is it possible to get tcl script todo:

Is it possible when my bot see a url like http://some.url.here.com then the tc lscript should do : store the new url like a bit.ly url instead...
_________________
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze


Last edited by Fire-Fox on Tue May 29, 2012 1:38 pm; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
Regex
Voice


Joined: 19 Mar 2011
Posts: 19

PostPosted: Mon May 28, 2012 11:07 am    Post subject: Reply with quote

Code:

#####################################################
##    dd0.in URL Shortener by Danneh/GrimReaper    ##
#####################################################
##                 Initial Setup                   ##
#####################################################

set dd0char "."

#####################################################
##                    End Setup                    ##
#####################################################

proc dd0url {nick host hand chan search} {
  if {[lsearch -exact [channel info $chan] +dd0url] != -1} {
    set dd0logo "\00312DD0 URL:\003"
    set dd0site "dd0.in"
    if {$search == ""} {
      putserv "PRIVMSG $chan :$dd0logo, Please enter a URL to shorten.."
    } else {
      set dd0srcurl "/api.php?action=shorturl&url=${search}&output=xml"
      if {[catch {set dd0srcsock [socket -async $dd0site 80]} sockerr]} {
        return 0
      } else {
        puts $dd0srcsock "GET $dd0srcurl HTTP/1.0"
        puts $dd0srcsock "Host: $dd0site"
        puts $dd0srcsock "User-Agent: Opera 9.6"
        puts $dd0srcsock ""
        flush $dd0srcsock
        while {![eof $dd0srcsock]} {
          set dd0status " [gets $dd0srcsock] "
          if {[regexp -all {<shorturl>(.*?)</shorturl>} $dd0status match dd0link]} {
            putserv "PRIVMSG $chan :$dd0logo ${dd0link}"
            close $dd0srcsock
            return 0
          }
        }
        close $dd0srcsock
        return 0
      }
    }
  }
}

bind pub - ${dd0char}dd0 dd0url
setudef flag dd0url
putlog "dd0.in URL Shortener by Danneh/GrimReaper"


Use it like that;

.chanset #yourchannel +dd0url
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber