All pastes #839053 Raw Edit

Miscellany

public text v1 · immutable
#839053 ·published 2007-12-30 20:44 UTC
rendered paste body
;;By: Pumakuma

alias weather {
  sockclose weather- $+ $replace($1-,$chr(32),+)
  sockopen weather- $+ $replace($1-,$chr(32),+) www.weather.com 80
}
on *:SOCKOPEN:weather*:{
  sockwrite -n $sockname GET /weather/local/ $+ $gettok($sockname,2-,45) $+ ?lswe= $+ $gettok($sockname,2-,45) $+ &lwsa=WeatherLocalUndeclared&from=whatwhere HTTP/1.1
  sockwrite -n $sockname Host: www.weather.com
  sockwrite -n $sockname Connection: close
  sockwrite -n $sockname User-Agent: Mozilla/3.0 (compatible)
  sockwrite -n $sockname Authorization: Basic 
  sockwrite -n $sockname $crlf
}
on *:sockread:weather*: {
  sockread %temp
  if (">Updated isin %temp) {
    set %we.update $nohtml(%temp) | haltdef
  }
  if (</B></TD> isin %temp) { 
    if (                                         isin $nohtml(%temp)) {
      set %we.cond $remove($nohtml(%temp),$chr(9)) | haltdef
    }
  }
  if (ALIGN="left"><H2 CLASS="moduleTitleBar"><B>Right Now for</B><BR> isin %temp) { 
    set %we.loc $remove($remove($gettok($nohtml(%temp),3-,32),for),Save this Location) | haltdef
  }
  if (Feels Like isin %temp) { 
    set %we.temp $remove($nohtml(%temp),$chr(9)) | set %we.temperature $remove($replace($gettok(%we.temp,1,32),&deg;, $+ $chr(176)),Feels) | set %we.feelslike $chr(40) $+ feels like $replace($gettok(%we.temp,3,32),&deg;, $+ $chr(176)) $+ $chr(41) | haltdef
  }
  if (*CLASS="obsTextA">*%</td>* iswm %temp) {
    set %we.hum %temp | set %we.humidity $gettok($gettok(%we.hum,2,62),1,60) | haltdef 
  }
  if (*CLASS="obsTextA">*mph</td>* iswm %temp) {
    set %we.wind %temp | set %we.windex $gettok($gettok(%we.wind,2,62),1,60) | haltdef
  }
  if (*CLASS="obsTextA">*&deg;*</td>* iswm %temp) {
    set %we.dew %temp | set %we.dewpoint $replace($gettok($gettok(%we.dew,2,62),1,60),&deg;, $+ $chr(176)) | haltdef
  }
  if (sunrise: isin %temp) {
    set %we.sunrise $remove($nohtml(%temp),$chr(9),sunrise:)
  }
  if (sunset: isin %temp) {
    set %we.sunset $remove($nohtml(%temp),$chr(9),sunset:)
  }
  if (*CLASS="obsTextA">*miles</td>* iswm %temp) {
    set %we.vis %temp | set %we.visibility $gettok($gettok(%we.vis,2,62),1,60) | haltdef
  }
}

on *:SOCKCLOSE:weather*:{
  msg %we.chan  $+ %we.loc $+ : %we.temperature %we.feelslike - Conditions: %we.cond - Humidity: %we.humidity - Visibility: %we.visibility - Wind: %we.windex - Dew Point: %we.dewpoint - Sunrise: %we.sunrise - Sunset: %we.sunset - $chr(40) $+ %we.update $+ $chr(41) | unset %we.  | unset %temp 
}

alias -l nohtml {
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&nbsp;)
  return %x
}

on *:TEXT:-weather *:#:{
  if ($2 isnum) && ($len($2) == 5) {
  /weather $2 | set %we.chan $chan }
  else {
    msg $chan Incorrect zip code format.
  }
} 

-----------------------------------------------------------------------------------------------------------------------------------

on *:TEXT:-commands:#:{
  notice $nick 4,1|0Commands4|0 4-0talk [msg] 4-0msg #chan/nick [msg] 4-0global [msg] 4-0join #chan 4-0part #chan 4-0hop #chan 4-0banchan #chan 4-0unbanchan #chan 4-0nick [newnick]4 |
  notice $nick 4,1|0Commands 24| 0,14-0op #chan [user] 4-0peon #chan [user] 4-0clvl #chan [user] [access] 4-0remuser #chan [user] 4-0ban #chan [user] 4-0unban #chan 4-0kick #chan [user][reason] 4-0invite [user] #chan 4-0weather [zipcode] 4-0reconnect 4-0perform #chan 4-0die 4-0auth 4|
  notice $nick 4,1|0Commands 34|0 4-0auser [5-1] 4-0addop [nick] 4-0delop [nick] 4-0botstatus 4-0slotstatus 4-0seen 4,1|  
}

on *:TEXT:-talk *:#:{
  if ($ulevel >= 1) {
    msg $chan  $2-
  }
  else {
    notice $nick Sorry $nick $+ , you do not have enough access for this command.
  }
}

on *:TEXT:-msg *:#:{
  if ($ulevel >= 3) {
    msg $2 $3- [MessageBy: $nick  $+ ]
  }
  else {
    notice $nick Sorry $nick $+ , you do not have enough access for this command.
  }
}

on *:TEXT:-global *:#:{
  if ($ulevel >= 4) {
    msg $chan [ $+ $nick $+ ] Now global messaging.  
    amsg $2- 
  }
  else {
    notice $nick Sorry $nick $+ , you do not have enough access for this command.
  }
}
on *:TEXT:-nick *:#:{
  if ($ulevel >= 4) {
    nick $2 $3-
  }
  else {
    notice $nick Sorry $nick $+ , you do not have enough access for this command.
  }
}

on *:TEXT:-op *:#: { if ($ulevel >= 4) { cs $2 addop $3 } {
    cs op $2 $3- 
    cs clvl $2 $3- 200
  }
  else {
    notice $nick Sorry $nick $+ , you do not have enough access for this command.
  }
}

on *:TEXT:-auth:#:{
  if ($ulevel >= 5) {
    /authserv auth xhype|serv 123456
    //mode $me +x 
  }
  else {
    notice $nick Sorry $nick $+ , you do not have enough access for this command.
  }
}

on *:TEXT:*:?: { msg ron- $+([,$nick,],:) $1- }
if ($ulevel >= 5) {
}

on *:TEXT:-peon *:#: { if ($ulevel >= 3) { cs $2 addpeon $3 } {
    cs deop $2 $3-
    cs clvl $2 $3- 100  
    cs voice $2 $3-
  }
  else {
    notice $nick Sorry $nick $+ , you do not have enough access for this command.
  }
}

on *:TEXT:-hop *:#: {
  if ($ulevel >= 3) {
    hop $2 
  }
  else {
    notice $nick Sorry $nick $+ , you do not have enough access for this command.
  }
}

on 1:TEXT:-reconnect:#: {
  if ($ulevel >= 5) {
    /server irc.gamesurge.net
  }
  else {
    notice $nick Sorry $nick $+ , you do not have enough access for this command.
  }
}

on *:TEXT:-remuser *:#: { if ($ulevel >= 4) { cs $2 addpeon $3 } {
    cs deop $2 $3-
    cs devoice $2 $3-
    cs deluser $2 $3-
  }
  else {
    notice $nick Sorry $nick $+ , you do not have enough access for this command.
  }
}

on *:TEXT:-ban *:#: { if ($ulevel >= 4) {
    cs deop $2 $3-
    cs devoice $2 $3-
    cs deluser $2 $3-
    cs kickban $2 $3- Bye Loser
  }
  else {
    notice $nick Sorry $nick $+ , you do not have enough access for this command.
  }
}

on *:TEXT:-unban *:#: { if ($ulevel >= 4) {
    cs deluser $2 $3-
    cs delban $2 $3-
  }
  else {
    notice $nick Sorry $nick $+ , you do not have enough access for this command.
  }
}

on 1:TEXT:-die:#: {
  if ($ulevel >= 5) {
    quit Die Commanded Issued By $nick $+ 
  }
  else {
    notice $nick Sorry $nick $+ , you do not have enough access for this command.
  }
}

on *:TEXT:-invite *:#: {
  if ($ulevel >= 3) {
    /invite $2 $3-
  }
  else {
    notice $nick Sorry $nick $+ , you do not have enough access for this command.
  }
} 

on *:TEXT:-perform*:#: {
  if ($ulevel >= 4) {
    msg $chan !uset autoinvite 1
  }
  else {
    notice $nick Sorry $nick $+ , you do not have enough access for this command.
  }
}

on *:TEXT:-clvl *:#: {
  if ($ulevel >= 5) {
    cs clvl $2 $3-
  }
  else {
    notice $nick Sorry $nick $+ , you do not have enough access for this command.
  }
} 

on *:TEXT:-kick *:#: { if ($ulevel >= 3) {
    cs kick $2 $3-
  }
  else {
    notice $nick Sorry $nick $+ , you do not have enough access for this command.
  }
}

on 1:TEXT:-botstatus:#: {
  .msg $chan 4,1|0System Uptime4:0 $duration($uptime,1) 4,1|0Bot Uptime4:0 $duration($uptime,1) 4|0Operating System4:0 Windows XP 4| {
  }
}

on 1:TEXT:-slotstatus:#: {
  .msg $chan 4,1|0 Currently in $chan(0) Channels, and $calc(20-$chan(0)) available. 4|
}

on *:TEXT:-auser*:#: { 
  if ($ulevel >= 5) {
    /auser $2-
  }
  else {
    notice $nick Sorry $nick $+ , you do not have enough access for this command.
  }
}

-------------------------------------------------------------------------------------------------------------------------------------

on *:start: {
  jc.start
}
alias jc.start {
  if ( %control.chan == $null ) {
    set %control.chan $$?="Enter Your bot's Control Channel:"
  }
  join %control.chan
}

on *:text:*:%control.chan: {
  if ( $1 == -join ) {
    if ( $2 == $null ) { 
      .msg $chan $nick You must specify a Channel for me to join.
    }
    elseif ( $2 ischan ) { 
      .msg $chan $nick Sorry, I'm already on that Channel.
    }
    elseif ( $($+(%,banned.,$2),2) != $null ) { 
      .msg $chan $nick Sorry, I'm prevented from joining that Channel. 
    }
    elseif ( $left($2,1) == $chr(35) ) || ( $left($2,1) == $chr(38) ) {
      set $+(%,join.,$2) $nick
      .join $2
    }
  }
  if ( $1 == -part ) {
    if ( $2 ischan ) && ( $nick == $($+(%,join.,$2),2) ) || ( $nick isop $chan ) {
      .part $2 Part Requested by $nick
      unset $+(%,join.,$2)
    }
    elseif ( $2 !ischan ) {
      .msg $chan $nick I'm not Currently on that Channel.
    }
    elseif ( $nick != $($+(%,join.,$2),2) ) {
      .msg $chan $nick Sorry. Only the nick that requested that I joined $2 can request that I part it. Requested by $($+(%,join.,$2),2)
    }
    elseif ( $2 == $null ) {
      .msg $chan $nick Please Specify a Channel.
    }
  }
  if ( $1 == -banchan ) {
    if ( $nick isop $chan ) {
      if ( $2 == $null ) {
        .msg $chan $nick You must specify a Channel to ban.
      }
      elseif ( $($+(%,banned.,$2),2) == $null ) && ( $left($2,1) == $chr(35) ) || ( $left($2,1) == $chr(38) ) {
        set $+(%,banned.,$2) banned
        if ( $2 ischan ) {
          .part $2 This channel has been banned from me joining.
        }
      }
      elseif ( $($+(%,banned.,$2),2) != $null ) {
        .msg $chan $nick $2 is already a banned channel.
      }
    }
  }
  if ( $1 == -unbanchan ) {
    if ( $nick isop $chan ) {
      if ( $2 == $null ) {
        .msg $chan $nick You must specify a Channel to ban.
      }
      elseif ( $($+(%,banned.,$2),2) != $null ) {
        .unset $+(%,banned.,$2)
        .msg $chan $nick $2 has been Unabanned
      }
      elseif ( $($+(%,banned.,$2),2) == $null ) {
        .msg $chan $nick $2 is not banned.
      }
    }
  }
}
on *:part:%control.chan: {
  var %x 1
  while ( %x <= $var(%join.*,0) ) {
    if ( $nick == $($var(%join.*,%x),2) ) {
      .part $deltok($var(%join.*,%x),1,46) $($var(%join.*,%x),2) Parted my control Channel. You must be in it to keep this bot in your channel.
      $($var(%join.*,%x))
    }
    inc %x
  }
}
on *:QUIT: {
  var %x 1
  while ( %x <= $var(%join.*,0) ) {
    if ( $nick == $($var(%join.*,%x),2) ) {
      .part $deltok($var(%join.*,%x),1,46) $($var(%join.*,%x)) Quit my control Channel. You must be in it to keep this bot in your channel.
      unset $($var(%join.*,%x))
    }
    inc %x
  }
}

------------------------------------------------------------------------------------------------------------------------------------

;;INI User System
;;Created By Technique
;;technique420@gmail.com

alias joincmds {
  if ($readini(Users.ini,Ops,$nick)) {
    mode %chan o $nick
  }
  if ($readini(Users.ini,Masters,$nick)) {
    mode %chan o $nick
  }
  if ($readini(Users.ini,Owner,$nick)) {
    mode %chan o $nick
  }
  if ($readini(Users.ini,Coowners,$nick)) {
    mode %chan o $nick
  }
  if ($readini(Users.ini,Peons,$nick)) {
    mode %chan voice $nick
  }
}

alias nickchange {
  if ($readini(Users.ini,Ops,$nick)) {
    remini Users.ini Ops $nick $address($nick,2)
    writeini Users.ini Ops $newnick $address($newnick,2)
  }
  if ($readini(Users.ini,Masters,$nick)) {
    remini Users.ini Masters $nick $address($nick,2)
    writeini Users.ini Masters $newnick $address($newnick,2)
  }
  if ($readini(Users.ini,Owner,$nick)) {
    remini Users.ini Owner $nick $address($nick,2)
    writeini Users.ini Owner $newnick $address($newnick,2)
  }
  if ($readini(Users.ini,Coowners,$nick)) {
    remini Users.ini Coowners $nick $address($nick,2)
    writeini Users.ini Coowners $newnick $address($newnick,2)
  }
  if ($readini(Users.ini,Peons,$nick)) {
    remini Users.ini Peons $nick $address($nick,2)
    writeini Users.ini Peons $newnick $address($newnick,2)
  }
}

alias startup {
  writeini Users.ini Owner $me $address($me,2)
  echo -a You have been added as the owner.
}

alias addchan {
  set %chan $1
  echo -a Channel Added.
}

alias addowner {
  writeini Users.ini Owner $1 $address($1,2)
  echo -a Added $1 $+ .
}

alias addco {
  writeini Users.ini Coowners $1 $address($1,2)
  echo -a Added $1 $+ .
}

on *:NICK:{
  nickchange
}

on *:JOIN:#:{
  joincmds
}

on *:TEXT:.addop*:#:{
  if ($nick isop $chan) {
    if ($readini(Users.ini,Owner,$nick)) || ($readini(Users.ini,Masters,$nick)) || ($readini(Users.ini,Masters,$nick)) || ($readini(Users.ini,Coowners,$nick)) {
      if (!$2) {
        notice $nick Invalid Syntax: .addop NAMEHERE
        halt
      }
      if ($2 !ison $chan) {
        notice $nick Error: $2 is not in $chan $+ .
        halt
      }
      if ($readini(Users.ini,Ops,$2)) {
        notice $nick Error: $2 is already on the userlist.
        halt
      }
      else {
        whois $2
        timer 1 2 writeini Users.ini Ops $2 $address($2,2)
        notice $nick Success: $2 has been added to the userlist.
        mode $chan +o $2
      }
    }
    else {
      notice $nick You dont have anough access to use this command.
      halt
    }
  }
}

on *:TEXT:.delop*:#:{
  if ($nick isop $chan) {
    if ($readini(Users.ini,Owner,$nick)) || ($readini(Users.ini,Masters,$nick)) || ($readini(Users.ini,Masters,$nick)) || ($readini(Users.ini,Coowners,$nick)) {
      if (!$2) {
        notice $nick Invalid Syntax: .delop NAMEHERE
        halt
      }
      if ($2 !ison $chan) {
        notice $nick Error: $2 is not in $chan $+ .
        halt
      }
      if (!$readini(Users.ini,Ops,$2)) {
        notice $nick Error: $2 is not on the userlist.
        halt
      }
      else {
        remini Users.ini Ops $2 $address($2,2)
        notice $nick Success: $2 has been deleted from the userlist
        mode $chan -o $2
      }
    }
    else {
      notice $nick You dont have anough access to use this command.
      halt
    }
  }
}

on *:TEXT:.access*:#:{
  if ($nick isop $chan) || ($nick isvoice $chan) {
    if (!$2) {
      if ($readini(Users.ini,Peons,$nick)) {
        notice $nick Access: 100
        halt
      }
      if ($readini(Users.ini,Ops,$nick)) {
        notice $nick Access: 200
        halt
      }
      if ($readini(Users.ini,Masters,$nick)) {
        notice $nick Access: 300
        halt
      }
      if ($readini(Users.ini,Coowners,$nick)) {
        notice $nick Access: 400
        halt
      }
      if ($readini(Users.ini,Owner,$nick)) {
        notice $nick Access: 500
        halt
      }
    }
    else {
      if ($readini(Users.ini,Peons,$2)) {
        notice $nick Access for $2 $+ : 100
        halt
      }
      if ($readini(Users.ini,Ops,$2)) {
        notice $nick Access for $2 $+ : 200
        halt
      }
      if ($readini(Users.ini,Masters,$2)) {
        notice $nick Access for $2 $+ : 300
        halt
      }
      if ($readini(Users.ini,Coowners,$2)) {
        notice $nick Access for $2 $+ : 400
        halt
      }
      if ($readini(Users.ini,Owner,$2)) {
        notice $nick Access for $2 $+ : 500
        halt
      }
    }
  }
}