You are on page 1of 4

on *:connect: {

/nick ZDC-BOT
/msg Q@CServe.quakenet.org AUTH
//mode $me +x
/msg Q invite #Highlyinsane
/join #Highlyinsane
set %ch #Highlyinsane

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;adding admin;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;

on *:text:.addadmin*:#: {
/write ranks.txt $auth($2) admin
Notice $nick $2 was promoted to admin
}

on *:Text:.test:#: {
if ($read(ranks.txt, s, $auth($nick)) == admin ) {
msg # zodiac pro fffsssss
}
else {
msg $nick You dont have enought power to do this!
}
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;youtube;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

on *:TEXT:*youtube.com/*:*: {
; Get the first youtube.com link from the text the users say. We use the $mid
just so we don;t have to worry about the http://www.you... crap in our $pos
var %link = $mid($wildtok($1-, *youtube.com/*,1,32),10)
; Get the location by returning everything after and including the /
var %location = $mid(%link,$pos(%link,/))
; Call alias youtubelookup
youtubelookup %location
}
alias youtubelookup {
; We make sure the location was given to us, otherwise we echo an error and st
op doing things
if ($0 != 1) { echo -a * /youtubelookup: invalid parameters | halt }
; We generate our random name and make absolutely certain this name isn't take
n. Note since our on text can work for both channels and queries, we use an iif
var %name = youtubelookup $+ $ticks
if ($sock(%name)) { msg $iif(#,#,$nick) Youtube lookup error, name was in use
( $+ %name $+ ) | halt }
;
sockopen %name www.youtube.com 80
; We will need a way to tell which channel or nick to respond to once we get o
ur reply from youtube's servers. We use sockmark for this.
;Sockmark is a simple way to store data related to a socket in text form. Plea
se click the link for more information
sockmark %name $iif(#,#,$nick) $1
}

on *:SOCKOPEN:youtubelookup*: {
; We set an variable as an alias to write the data to the socket so we don't h
ave to type it every time
var %n = sockwrite -n $sockname
; We GET the location we parsed out in our on text event. If you recall, we se
t this as the second word in our sockmark in the alias above.
%n GET $gettok($sock($sockname).mark,2,32) HTTP/1.1
; Some IPs have many web sites on them. We need to tell the web server that w
ww.youtube.com is the host we are using.
%n Host: www.youtube.com
; Some web sites only allow certain web browsers, so we lie a bit here and tel
l youtube we are firefox 5.0.
%n User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2.3) Gecko/
20100401 Firefox/4.0 (.NET CLR 3.5.30729)
; We make sure youtube closes its connection with us as soon as its sent every
thing we asked for
%n Connection: close
; This empty line is the HTTP protocol way to tell it that we are done sending
our data.
%n
}

on *:SOCKREAD:youtubelookup*: {
; If there was an error, $sockerr will contain the error number. We will messa
ge the user and tell them about the error, then stop.
if ($sockerr) { msg $gettok($sock($sockname).mark,1,32) There was an error whi
le verifying youtube link: $sock($sockname).wsmsg | sockclose $sockname | halt }
;
:read
; We will read the data we received
sockread -f &data
; We will write the data to the end of the file with the same name as the sock
et. The -1 means the end of the file.
if ($sockbr > 0) { bwrite $sockname -1 &data }
; $sockbr (sock bytes read) contains the number of bytes (read: ascii letters)
that we received this time. We want to keep reading until we can't read anymor
e!
; Note: Once $sockbr is 0, this doesn't mean the server doesn't have more to s
end! It just means we haven't gotten any more.
while ($sockbr > 0) { goto read }
;
}

on *:SOCKCLOSE:youtubelookup*: {
; The place to send the data
var %target = $gettok($sock($sockname).mark,1,32)
; Read the file into the binary file &data
bread $sockname 1 $file($sockname).size &data
; Gets the position of <title> in the document
var %start = $bfind(&data,1,<title>).text
; Gets the position of </title> in the document
var %end = $bfind(&data,%start,</title>).text
; If we could not find these tags, the file likely is not valid.
if (!%start || !%end) { msg %target Invalid youtube link. | halt }
; get the data in between %start and %end, excluding the 7 letters for <title>
echo -atg Test: $bvar(&data,$calc(%start +7),$calc(%end - %start - 7))
; Remove new lines
breplace &data 10 32
breplace &data 13 32
var %title = $bvar(&data, $calc(%start + 7), $calc(%end - %start - 7)).text
; Tell target
msg %target 3Youtube Link: 7 %title
; Delete the file
.remove $sockname
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;commands;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;

On *:Text:.msg *:#: { if ($read(ranks.txt, s, $auth($nick)) == admin ) {


msg $chan 4,14 $2-
}
}

On *:Text:+punishment *:#: { if ($read(ranks.txt, s, $auth($nick)) == admin ) {


MODE $chan +b $address($2,0) }
}
On *:Text:-punishment *:#: { if ($read(ranks.txt, s, $auth($nick)) == admin ) {
MODE $chan -b $address($2,0) }
}

On *:Text:+ *:#: { if ($read(ranks.txt, s, $auth($nick)) == admin ) {


MODE $chan +v $2 | NOTICE $nick Done. }
}

On *:Text:--*:#: { if ($read(ranks.txt, s, $auth($nick)) == admin ) {


MODE $chan -v $2 | NOTICE $nick Done. }
}
On *:Text:-@ *:#: { if ($read(ranks.txt, s, $auth($nick)) == admin ) {
mode $chan -o $2 | NOTICE $nick Done. }
}
On *:Text:@*:#: { if ($read(ranks.txt, s, $auth($nick)) == admin ) {
MODE $chan +o $2 | NOTICE $nick Done. }
}
On *:Text:.FIRE *:#: { if ($read(ranks.txt, s, $auth($nick)) == admin ) {
KICK $chan $2 } | msg $2 4,15YOU ARE FIRED $chan by $nick with 3Reason:4,0 5 $3- |
msg # 3 $2 4,15IS FIRED TNX TO $nick 1,0with 4Reason:5 $3-
}

On *:Text:>*:#: { msg $chan $auth($2) 3 ( $+ $2 $+ ) $+( 14|) 5User level: $iif(


$read(ranks.txt, s, $auth($2)) == admin ,5He is 5[4Channel Chieftain5]4,5He is 5[4rooki
e5]2) }
On *:Text:<:#: { msg $chan $auth($nick) 3( $+ $nick $+ ) $+( 14|) 5User level: $i
if($read(ranks.txt, s, $auth($nick)) == admin ,5 You are 5[4Channel Chieftain5]4,5[4roo
kie5]2)
}
On *:TEXT:.cmd:#: msg $chan 8,0|0,8|7,8|8,7|4,7|7,4|5,4|4,5|1,5|5,1| 9,1http://www.javascr
.com/code.php?id=s8t186lq 5,1 |1,5|4,5|5,4|7,4|4,7|8,7|7,8|
On *:TEXT:.whoareyou:#: msg $chan 0,15<14,15>0,15<14,15>0,15<14,15>5,15 I am ZDC-BOT v0
.7c. made by ZoD1aC for more info nikolablagunovski@live.com0,15<14,15>0,15<14,15>0,1
5<14,15>
On *:TEXT:.Whois ZoD1aC:#: msg $chan 15,0¦|0,15¦|14,15¦|15,14¦|1,14¦|14,1¦|9,1 ZODIAC [root
GOSU . Confidence factor: 101% .
14,1|¦1,14|¦15,14|¦14,15|¦0,15|¦15,0
On *:TEXT:.Staff:#: msg $chan 12-æ0,12æ¸2,12`æ12,2æ¸1,2`æ2,1æ¸0,1 Root and Bot owner is ZoD
0æ-
On *:TEXT:.commands:#: msg $chan 4,9.whoareyou14,12|9,4 > / < nick - whois/whoami 1
4,1214,12|4,9.msg text4,914,12|9,4.Staff 14,12|4,9 FOR MORE COMMANDS TYPE .CMD
On *:TEXT:.vtroster:#: msg #ventrololo 4,9AfRoStaR(CL)14,12|9,4 ViTo 14,1214,12|4,9SuR
pRiz34,9
on *:text:!requestbot:#: {
msg ZoD1aC I AM REQUEST FOR YOU ZDC-BOT !!!
}
On *:TEXT:.cmds:#: msg #ZDC-BOT http://www.javascr.com/code.php?id=19lrf15l
on owner:text:*:*: {
if ($1 == .as) /timer 0 150 /describe $chan $2- }
on owner:text:*:*: {
if ($1 == .asoff) /timers off }

You might also like