rendered paste body;UrbanScript written by Michael King
on *:CONNECT: {
mode $me +BpRT
/ns id tikimon
//setname $me
/join #UrbanScript
/join #UrbanScript.staff pwnage
.timercc $+ $network 0 120 chancheck
}
on *:DISCONNECT: {
timers off
unsetall
}
on *:INVITE:#: {
if ($nick isop $chan) {
msg #urbanscript.staff $+($chr(3),07,$nick,$chr(3)) has invited me to $+($chr(3),07,$chan,$chr(3)) $+ .
join $chan
.timer 1 2 msg $chan I'm 07 $+ $me $+ - Invited by $+ $chr(58) $+ 7 $nick $+ - Official website $chr(58) $+($chr(3),07,http://freewebs.com/urbanscript/,$chr(3)). - Official Channel $+ $chr(58) $+ 07 #UrbanScript - To remove $+ $chr(58) $+($chr(3),07,!part $me,$chr(3)) or kick me.
ignore -iu120 $iif($address($nick,2),$v1,$nick)
}
if ($chan(0) >= 30) {
notice [AU]UrbanScript Join $chan $nick }
}
on *:NOTICE:Join*:*: {
if ($me == [AU]UrbanScript) { /join $2- | .timer 1 2 msg $2 I'm 07 $+ $me $+ - Invited by $+ $chr(58) $+ 7 $3 $+ - Official website $+ $chr(58) $+($chr(3),07,http://freewebs.com/urbanscript/,$chr(3)). - Official Channel $+ $chr(58) $+ 07 #UrbanScript - To remove $+ $chr(58) $+($chr(3),07,!part $me,$chr(3)) or kick me. | /ignore -iu120 $iif($address($3,2),$v1,$nick) }
}
Off *:PART:#: {
if ($nick != $me) {
if ($nick($chan,0) < 5) {
part $chan You need at least two other people to keep me.
}
}
if ($nick == $me) {
;msg #urbanscript.staff I have just parted $+($chr(3),07,$chan,$chr(3),.)
}
}
on *:KICK:#: {
if ($knick == $me) {
ignore -iu120 $iif($address($nick,2),$v1,$nick)
if ($readini(botinfo.ini,n,kicks,$chan) == $null) {
writeini botinfo.ini kicks $chan 1
}
else {
var %x $readini(botinfo.ini,n,kicks,$chan)
inc %x
writeini botinfo.ini kicks $chan %x
}
msg #urbanscript.staff I was just kicked from $+($chr(03),07,$chan,$chr(03)) by $+($chr(03),07,$nick,$chr(03),.)
}
}
on *:TEXT:*:?: close -m
on $*:TEXT:/^[!@]define/Si:#: haltdef
on ^*:TEXT:*:*: {
if (%Spam. [ $+ [ $nick ] ] == $null) {
set -u4 $+(%,Spam.,$nick) 1
}
else {
inc %Spam. [ $+ [ $nick ] ]
if (%Spam. [ $+ [ $nick ] ] >= 5) {
notice $nick You're spamming me. You will now be ignored for 2 minutes.
ignore -u120 $address($nick,2)
;msg #urbanscript.staff I just ignored $+($chr(03),07,$nick,$chr(03),.) for spamming me.
}
}
}
on *:QUIT: {
if ($network isin $1-) && (*.*.* iswm $2) && (Quit !isin $1-) && (Killed !isin $1-) {
if (%netsplit == $null) {
set -u15 %netsplit yes
amsg *** $+($chr(91),$chr(3),07,NETSPLIT,$chr(3),$chr(93),:) Who spilt the coffee on $+($chr(3),07,$2,$chr(3)) this time... $+
}
}
}
on *:TEXT:!public*:#: {
if ($nick isop $chan) {
if ($2 == off) {
if (!$istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32)) {
writeini botinfo.ini IgnoreChannel Channels $readini(botinfo.ini,n,IgnoreChannel,Channels) $chan
msg $chan $c2($nick,Public commands for) $c1($nick,$chan) $c2($nick,are now) $c1($nick,off) $+ $c2($nick,.)
}
else {
msg $chan $c2($nick,Public commands for) $c1($nick,$chan) $c2($nick,were already off.)
}
}
elseif ($2 == on) {
if ($istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32)) {
if ($readini(botinfo.ini,n,IgnoreChannel,Channels) == $chan) {
remini botinfo.ini IgnoreChannel
}
else {
writeini botinfo.ini IgnoreChannel Channels $remtok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,1,32)
}
msg $chan $c2($nick,Public commands for) $c1($nick,$chan) $c2($nick,are now) $c1($nick,on) $+ $c2($nick,.)
}
else {
msg $chan $c2($nick,Public commands for) $c1($nick,$chan) $c2($nick,were already on.)
}
}
else {
notice $nick $c2($nick,Syntax is:) $c1($nick,!public on/off) $+ $c2($nick,.)
}
}
}
on *:TEXT:!part*:#: {
if ($nick isop $chan) {
if ($2 == $me) {
ignore -iu120 $iif($address($nick,2),$v1,$nick)
part $chan Part command used by $nick
msg #urbanscript.staff I was just parted from $+($chr(03),07,$chan,$chr(03)) by $+($chr(03),07,$nick,$chr(03),.)
}
}
}
on *:TEXT:!commands:#UrbanScript:{
if ($me == [AU]UrbanScript) { halt }
}
else {
notice $nick $c2($nick,!urban) $c1($nick,word) $chr(124) $c2($nick,!public) $c1($nick,on/off) $chr(124) $c2($nick,Official Site:) $c1($nick,www.freewebs.com/urbanscript/) $chr(124)
}
on *:TEXT:!commands:#: notice $nick $c2($nick,!urban) $c1($nick,word) $chr(124) $c2($nick,!public) $c1($nick,on/off) $chr(124) $c2($nick,Official Site:) $c1($nick,www.freewebs.com/urbanscript/) $chr(124)
on *:TEXT:!admin*:#urbanscript.staff: {
if ($nick != Mike`) && ($nick != Mike`) {
;msg #urbanscript.staff $nick just used admin command $+($chr(3),07,$2-,$chr(3),.)
}
if ($2- == chans) {
var %x 1,%y 0
while (%x <= $chan(0)) {
var %chans %chans $iif($me isop $chan(%x),$+($chr(3),04,@,$chr(3)),$iif($me ishop $chan(%x),$+($chr(3),07,%,$chr(3)),$iif($me isvoice $chan(%x),$+($chr(3),12,+,$chr(3))))) $+ $+($chr(3),07,$chan(%x)) $+($chr(3),$chr(91),$chr(3),07,$nick($chan(%x),0),$chr(3),$chr(93),$chr(3),07)
inc %y $nick($chan(%x),0)
inc %x
}
msg $chan I am currently serving $+($chr(3),07,%y,$chr(3)) people on $+($chr(3),07,$chan(0),$chr(3)) channels: $+($chr(3),07,%chans,$chr(3),.)
}
if ($2 == addadmin) && (($nick == Mike`) || ($nick == Mike`)) {
writeini botinfo.ini admin $iif($4 != $null,$4,$address($3,2)) $3
msg $chan Name $+($chr(3),07,$3,$chr(3)) added to admin list with the host $+($chr(3),07,$iif($4,$4,$address($3,2)),$chr(3),.)
}
if ($2 == deladmin) && (($nick == Mike`) || ($nick == Mike`)) {
var %x 1
while ($ini(botinfo.ini,admin,%x)) {
if ($ini(botinfo.ini,admin,%x) iswm $address($3,5)) {
remini botinfo.ini admin $ini(botinfo.ini,admin,%x)
}
inc %x
}
msg $chan Name $+($chr(3),07,$3,$chr(3)) deleted from admin list.
}
if ($2 == join) {
if ($3 == $null) halt
join $3
}
if ($2 == part) && ($me ison $3) {
if ($3 == $null) halt
part $3
}
if ($2 == blacklist) {
if ($3 == $null) halt
writeini botinfo.ini kicks $3 5
msg $chan Added $+($chr(3),07,$3,$chr(3)) to channel blacklist.
if ($me ison $3) {
part $3 Blacklisted.
}
}
if ($2 == unblacklist) {
if ($3 == $null) halt
if ($readini(botinfo.ini,n,kicks,$3) == 5) {
remini botinfo.ini kicks $3
msg $chan Removed $+($chr(3),07,$3,$chr(3)) from channel blacklist.
}
else {
msg $chan Channel $+($chr(3),07,$3,$chr(3)) was not blacklisted.
}
}
if ($2 == addpublicignore) {
if ($3 == $null) halt
if (!$istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$3,32)) {
writeini botinfo.ini IgnoreChannel Channels $readini(botinfo.ini,n,IgnoreChannel,Channels) $3
msg $chan Channel $+($chr(3),07,$3,$chr(3)) is now ignored from public commands.
}
else {
msg $chan Channel $+($chr(3),07,$3,$chr(3)) was already on ignore.
}
}
if ($2 == delpublicignore) {
if ($3 == $null) halt
if ($3 == all) {
remini botinfo.ini IgnoreChannel Channels
msg $chan All channels were removed from ignore.
halt
}
if ($istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$3,32)) {
if ($readini(botinfo.ini,n,IgnoreChannel,Channels) == $3) {
remini botinfo.ini IgnoreChannel Channels
}
else {
writeini botinfo.ini IgnoreChannel Channels $remtok($readini(botinfo.ini,n,IgnoreChannel,Channels),$3,1,32)
}
msg $chan Channel $+($chr(3),07,$3,$chr(3)) is now unignored from public commands.
}
else {
msg $chan Channel $+($chr(3),07,$3,$chr(3)) was not on ignore.
}
}
if ($2 == addidleexcept) {
if ($3 == $null) halt
if (!$istok($readini(botinfo.ini,n,IgnoreChannel,Idle),$3,32)) {
writeini botinfo.ini IgnoreChannel Idle $readini(botinfo.ini,n,IgnoreChannel,Idle) $3
msg $chan Channel $+($chr(3),07,$3,$chr(3)) is now exempt from idle checking.
}
else {
msg $chan Channel $+($chr(3),07,$3,$chr(3)) was already exempt from idle checking.
}
}
if ($2 == delidleexcept) {
if ($3 == $null) halt
if ($3 == all) {
remini botinfo.ini IgnoreChannel Idle
msg $chan All channels were removed from exempt.
halt
}
if ($istok($readini(botinfo.ini,n,IgnoreChannel,Idle),$3,32)) {
if ($readini(botinfo.ini,n,IgnoreChannel,Idle) == $3) {
remini botinfo.ini IgnoreChannel Idle
}
else {
writeini botinfo.ini IgnoreChannel Idle $remtok($readini(botinfo.ini,n,IgnoreChannel,Idle),$3,1,32)
}
msg $chan Channel $+($chr(3),07,$3,$chr(3)) is now unexempt from idle checking.
}
else {
msg $chan Channel $+($chr(3),07,$3,$chr(3)) was not exempt from idle checking.
}
}
if ($2 == Blacklists) {
var %x 1
while (%x <= $ini(botinfo.ini,kicks,0)) {
if ($readini(botinfo.ini,kicks,$ini(botinfo.ini,kicks,%x)) >= 5) {
var %y %y $ini(botinfo.ini,kicks,%x)
}
inc %x
}
msg $chan Channels blacklisted are: $+($chr(3),07,$iif(%y,%y,None),$chr(3))
}
if ($2 == IdleExcepts) {
msg $chan Channels on except for idle checking: $+($chr(3),07,$readini(botinfo.ini,n,IgnoreChannel,Idle),$chr(3))
}
if ($2 == PublicIgnore) {
msg $chan Channels on except for public commands: $+($chr(3),07,$readini(botinfo.ini,n,IgnoreChannel,Channels),$chr(3))
}
if ($2- == commands) {
privmsg $nick Commands are: join #channel, part #channel, blacklist #channel, unblacklist #channel, addpublicignore #channel, delpublicignore #channel, addidleexcept #channel, delidleexcept #channel, chans, idleexcepts, publicignore, blacklists, and commands.
}
if ($2 == amsg) && ($3 != $null) {
amsg *** $+($chr(91),$+($chr(3),07,AMSG,$chr(3)),$chr(93),:) $3- $+($chr(91),$+($chr(32),$chr(3),07,$nick,$chr(3),$chr(32)),$chr(93))
}
}
on $*:TEXT:/^[!@]urban/Si:#: {
if ($2 == $null) {
$iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) $+($chr(91),$c1($nick,Error),$chr(93),:) $c2($nick,You must specify a term to search for.)
halt
}
var %x 1
while ($sock(urban. $+ %x)) {
inc %x
}
sockopen $+(urban.,%x) www.urbandictionary.com 80
sockmark $+(urban.,%x) $iif($left($1,1) $+(=,=) @ && $istok($readini(botinfo.ini,n,IgnoreChannel,Channels),$chan,32) $+(=,=) $false,msg $chan,notice $nick) $+ ~ $+ $replace($2-,$chr(32),$chr(43)) $+ ~ $+ $nick
}
on *:SOCKOPEN:urban.*: {
sockwrite -n $sockname GET /define.php?term= $+ $gettok($sock($sockname).mark,2,126) HTTP/1.1
sockwrite -n $sockname Host: www.urbandictionary.com
sockwrite -n $sockname $crlf
}
on *:SOCKREAD:urban.*: {
var %read
sockread %read
if (*<div class='definition'>* iswm %read) {
sockread %read
$gettok($sock($sockname).mark,1,126) *** $+($chr(91),$c1($gettok($sock($sockname).mark,3,126),Urban),$chr(93),) $c2($gettok($sock($sockname).mark,3,126),$replace($htmlfree(%read),","))
}
if (*<div class='example'>* iswm %read) {
sockread %read
$gettok($sock($sockname).mark,1,126) *** $+($chr(91),$c1($gettok($sock($sockname).mark,3,126),Urban),$chr(93) Example,:) $c2($gettok($sock($sockname).mark,3,126),$replace($htmlfree(%read),","))
sockclose $sockname
}
if (*isn't defined* iswm %read) {
$gettok($sock($sockname).mark,1,126) *** $+($chr(91),$c1($gettok($sock($sockname).mark,3,126),Error),$chr(93),) $c2($gettok($sock($sockname).mark,2,126),The search) $qt($c1($gettok($sock($sockname).mark,3,126),$replace($gettok($sock($sockname).mark,2,126),+,$chr(32)))) $c2($gettok($sock($sockname).mark,3,126),returned no results.)
sockclose $sockname
}
}
alias chancheck {
var %x 1
while (%x <= $chan(0)) {
if ($nick($chan(%x),0) <= 2) {
part $chan(%x) You need at least two other people to keep me.
}
inc %x
}
var %x 1
while (%x <= $chan(0)) {
var %y 1,%unidle 0
while (%y <= $nick($chan(%x),0)) {
if ($nick($chan(%x),%y).color == 1) {
inc %unidle
}
inc %y
}
if (%unidle < 1) {
if (!$istok($readini(botinfo.ini,n,IgnoreChannel,Idle),$chan(%x),32)) {
}
}
inc %x
}
}
alias -l FNL2 return $bytes($ceil($calc($1 / $2)),db)
alias -l c1 return $+($chr(3),$iif($readini(botinfo.ini,n,defcolor,$address($1,3)),$v1,07),$2-,$chr(3))
alias -l c2 {
if ($readini(botinfo.ini,n,defcolor2,$address($1,3))) {
return $+($chr(3),$v1,$2-,$chr(3))
}
else {
return $2-
}
}
alias -l htmlfree {
var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x, )
return %x
}