Radio Bot
Posted by chriscloyd
Monday, March 05, 2007
Description: here not completely finished

on *:load:{
  set %channel #FragRadio
  set %serverip1 68.104.214.32
  set %serverip2 64.46.36.178
  set %port1 8000
  set %port2 8002
}
on *:JOIN:%channel {
  notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 Welcome to %channel Where we bring music to you 24/7 [^K]8[^B])[^B]
  notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 Type @Commands to see a list of commands [^K]8[^B])[^B]
  notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 If you want the bot in your channel type [^B]@apply[^B] [^K]8[^B])[^B]
  if ($ulevel >= 100) {
    var %info $ulist($address($nick,1),$ulevel,1).info
    msg $chan [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 $nick $+ , is %info [^K]8[^B])[^B]
  }
}
on *:NICK:# {
  if ($nick == %dj) {
    set %dj $newnick
    amsg [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 DJ` $+ $nick changed his name to $newnick [^K]8[^B])[^B]
  }
}
on *:TEXT:@commands:# {
  notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B]
  notice $nick [^K]8,1[^B]([^B] [^K]0Stream - @stream [^K]8[^B])[^B]
  notice $nick [^K]8,1[^B]([^B] [^K]0Song - @song [^K]8[^B])[^B]
  notice $nick [^K]8,1[^B]([^B] [^K]0Listeners - @listeners [^K]8[^B])[^B]
  notice $nick [^K]8,1[^B]([^B] [^K]0Dj - @dj [^K]8[^B])[^B]
  notice $nick [^K]8,1[^B]([^B] [^K]0Shoutout - @shoutout [^K]8[^B])[^B]
  notice $nick [^K]8,1[^B]([^B] [^K]0Request - @request [^K]8[^B])[^B]
  notice $nick [^K]8,1[^B]([^B] [^K]0Cut - @cut [^K]8[^B])[^B]
  notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B]
}
on *:TEXT:@dj:# {
  if (%dj) {
    if ($nick == %dj) {
      notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 Your the dj that is annihilating the radio waves eh? [^K]8[^B])[^B]
    }
    else {
      notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 DJ` $+ %dj is on air, annihilating the radio waves [^K]8[^B])[^B]
    }
  }
  else {
    notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 Stream-1 Is Offline, Ask a DJ to go on [^K]8[^B])[^B]
  }
}
on 200:TEXT:@onair:# {
  if ($nick == %dj) {
    notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 Your on air already [^K]8[^B])[^B]
    halt
  }
  if (%dj) {
    notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 DJ` $+ %dj is on air [^K]8[^B])[^B]
    halt
  }  
  if (!%dj) {
    set %dj $nick
    msg $chan [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 DJ` $+ %dj is now on air, annihilating the radio waves [^K]8[^B])[^B]
    msg chanserv #fragradio set topic [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 DJ` $+ %dj is now on air, annihilating the radio waves [^K]8[^B])[^B]
  }
}
on 200:TEXT:@offair:# {
  if (%dj) {
    if ($nick == %dj) {
      set %requests on
      set %shoutouts on
      set %cuts on
      notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 DJ` $+ %dj is now of air. [^K]8[^B])[^B]
      amsg [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 DJ` $+ %dj is now of air. [^K]8[^B])[^B]
      msg chanserv #fragradio set topic [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 No Dj online right now, Ask one to get on [^K]8[^B])[^B]
      unset %dj
    }
  }
}
on *:TEXT:@shoutout*:# {
  if (!%dj) {
    notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 Stream Is Offline, Ask a DJ to go on [^K]8[^B])[^B]
  }
  else {
    if (!$2) {
      notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 You did not submit an actual shoutout [^K]8[^B])[^B]
      notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 Example: @Shoutout Frag Radio is the best [^K]8[^B])[^B][^B]
    }
    else {
      if ($2 == on) {
        if ($nick == %dj) {
          set %shoutouts on
          notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 You turned the command @shoutout on [^K]8[^B])[^B]
          msg $chan [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 DJ- $+ %dj turned the command @shoutouts on [^K]8[^B])[^B]
          halt
        }
      }
      if ($2 == off) {
        if ($nick == %dj) {
          set %shoutouts off
          notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 You turned the command @shoutouts off [^K]8[^B])[^B]
          msg $chan [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 DJ- $+ %dj turned the command @shoutouts off [^K]8[^B])[^B]
          halt
        }
      }
      if (%shoutouts == off) {
        notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 This command was turned off by DJ- $+ %dj [^K]8[^B])[^B]
        halt
      }
      if (%spam.shoutouts. [ $+ [ $nick ] ] == 1) {
        notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 You can only used this command once every minute [^K]8[^B])[^B]
        halt
      }
      else {
        set -u60 %spam.shoutouts. [ $+ [ $nick ] ] 1
        if ($nick == %dj) {
          notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 You nimrod, you cant send a shouout to your self [^K]8[^B])[^B]
        }
        else {
          notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 Your shoutout has been sent to DJ- $+ %dj [^K]8[^B])[^B]
          msg %dj [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 Shoutout by $nick $+ :  $2- [^K]8[^B])[^B]
        }
      }
    }
  }
}
on *:TEXT:@request*:# {
  if (!%dj) {
    notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 Stream Is Offline, Ask a DJ to go on [^K]8[^B])[^B]
  }
  else {
    if (!$2) {
      notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 You did not submit an actual request [^K]8[^B])[^B]
      notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 Example: @request %song1 [^K]8[^B])[^B][^B]
    }
    else {
      if ($2 == on) {
        if ($nick == %dj) {
          set %requests on
          notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 You turned the command @request on [^K]8[^B])[^B]
          msg $chan [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 DJ- $+ %dj turned the command @request on [^K]8[^B])[^B]
          halt
        }
      }
      if ($2 == off) {
        if ($nick == %dj) {
          set %requests off
          notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 You turned the command @request off [^K]8[^B])[^B]
          msg $chan [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 DJ- $+ %dj turned the command @request off [^K]8[^B])[^B]
          halt
        }
      }
      if (%requests == off) {
        notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 This command was turned off by DJ- $+ %dj [^K]8[^B])[^B]
        halt
      }
      if (%spam.request. [ $+ [ $nick ] ] == 1) {
        notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 You can only used this command once every minute [^K]8[^B])[^B]
        halt
      }
      else {
        set -u60 %spam.request. [ $+ [ $nick ] ] 1
        if ($nick == %dj) {
          notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 You nimrod, you cant send a request to your self [^K]8[^B])[^B]
        }
        else {
          notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 Your request has been sent to DJ- $+ %dj [^K]8[^B])[^B]
          msg %dj [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 Request by $nick $+ :  $2- [^K]8[^B])[^B]
        }
      }
    }
  }
}
on *:TEXT:@cut*:# {
  if (!%dj) {
    notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 Stream Is Offline, Ask a DJ to go on [^K]8[^B])[^B]
  }
  else {
    if ($2 == on) {
      if ($nick == %dj) {
        set %cuts on
        notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 You turned the command @cut on [^K]8[^B])[^B]
        msg $chan [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 DJ- $+ %dj turned the command @cut on [^K]8[^B])[^B]
        halt
      }
    }
    elseif ($2 == off) {
      if ($nick == %dj) {
        set %cuts off
        notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 You turned the command @cut off [^K]8[^B])[^B]
        msg $chan [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 DJ- $+ %dj turned the command @cut off [^K]8[^B])[^B]
        halt
      }
    }
    else {
      if (%cuts == off) {
        notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 This command was turned off by DJ- $+ %dj [^K]8[^B])[^B]
        halt
      }
      if (%spam.cuts. [ $+ [ $nick ] ] == 1) {
        notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 You can only used this command once every minute [^K]8[^B])[^B]
        halt
      }
      else {
        set -u60 %spam.cuts. [ $+ [ $nick ] ] 1
        if ($nick == %dj) {
          notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 You nimrod, you cant cut your self [^K]8[^B])[^B]
        }
        else {
          notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 Your cut request has been sent to DJ- $+ %dj [^K]8[^B])[^B]
          msg %dj [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 Request to cut the song has been sent by $nick [^K]8[^B])[^B]
        }
      }
    }
  }
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;@server Command
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



on *:TEXT:@stream:#:{
  if (%dj) {
    set %ask.nick $nick
    set %ask.chan $chan
    sockclose server1
    sockopen server1 %serverip1 %port1
  }
  else {
    notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 Stream Is Offline, Ask a DJ to go on [^K]8[^B])[^B]
  }
}
on *:SOCKOPEN:server1:{
  sockwrite -n $sockname GET /7.html HTTP/1.0
  sockwrite -n $sockname User-Agent: Mozilla
  sockwrite -n $sockname $crlf
}
on *:sockread:server1:{
  if ($sockerr > 0) {
    msg %ask.chan [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 Stream-1 Is Offline, Ask a DJ to go on [^K]8[^B])[^B]
    return
  }
  :nextread
  sockread -f %scasttemp1
  if ($sockbr == 0) return
  if (%scasttemp1 == $null) %scasttemp1 = empty
  set %scasttemp1 $remove(%scasttemp1,<HTML><meta http-equiv="Pragma" content="no-cache"></head><body>,</body></html>)
  if ((HTTP/1.* !iswm %scasttemp1) && (content-type* !iswm %scasttemp1) && (%scasttemp1 != empty)) {
    set %status1 $gettok(%scasttemp1,2,44)    
    set %asong $gettok(%scasttemp1,7-,44)
    set %listeners1 $gettok(%scasttemp1,1,44)
    set %peak1 $gettok(%scasttemp1,3,44)
    set %song1 $replace(%asong,&,$chr(38),',$chr(39))
  }
  goto nextread
}
on *:sockclose:server1:{
  if (%status1 == 0) {
    msg %ask.chan [^K]8,1[^B]([^B] [^K]0[^B]#Frag-Radio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 Stream-1 Is Offline, Ask a DJ to go on [^K]8[^B])[^B]
  }
  else {
    notice %ask.nick [^K]8,1[^B]([^B] [^K]0[^B]#Frag-Radio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 Stream-1: http:// $+ %serverip1 $+ : $+ %port1 $+ /listen.pls [^B]×[^B] DJ: %dj [^K]8[^B])
    notice %ask.nick [^K]8,1[^B]([^B] [^K]0[^B]#Frag-Radio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 Song: %song1 [^B]×[^B] Listeners: %listeners1 $+ /1337 [^B]×[^B] Peak: %peak1 [^K]8[^B])[^B]
  }
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;@server Command
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



on *:TEXT:@song:#:{
  if (!%dj) { notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#Frag-Radio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 Stream-1 Is Offline, Ask a DJ to go on [^K]8[^B])[^B] | halt }
  set %ask.nick $nick
  set %ask.chan $chan
  sockclose song1
  sockopen song1 %serverip1 %port1
}
on *:SOCKOPEN:song1:{
  sockwrite -n $sockname GET /7.html HTTP/1.0
  sockwrite -n $sockname User-Agent: Mozilla
  sockwrite -n $sockname $crlf
}
on *:sockread:song1:{
  if ($sockerr > 0) return
  :nextread
  sockread -f %scasttemp1
  if ($sockbr == 0) return
  if (%scasttemp1 == $null) %scasttemp1 = empty
  set %scasttemp1 $remove(%scasttemp1,<HTML><meta http-equiv="Pragma" content="no-cache"></head><body>,</body></html>)
  if ((HTTP/1.* !iswm %scasttemp1) && (content-type* !iswm %scasttemp1) && (%scasttemp1 != empty)) {
    set %status1 $gettok(%scasttemp1,2,44)    
    set %asong1 $gettok(%scasttemp1,7-,44)
    set %listeners1 $gettok(%scasttemp1,1,44)
    set %peak1 $gettok(%scasttemp1,3,44)
    set %song1 $replace(%asong1,&,$chr(38),',$chr(39))
  }
  goto nextread
}
on *:sockclose:song1:{
  if (%status1 == 0) {
    msg %ask.chan [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 Stream-1 Is Offline, Ask a DJ to go on [^K]8[^B])[^B]
  }
  else {
    notice %ask.nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 Song: %song1 [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B]
  }
}



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;@listeners Command
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



on *:TEXT:@listeners:#:{
  if (!%dj) { notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#Frag-Radio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 Stream Is Offline, Ask a DJ to go on [^K]8[^B])[^B] | halt }
  set %ask.nick $nick
  set %ask.chan $chan
  sockclose listeners1
  sockopen listeners1 %serverip1 %port1
}
on *:SOCKOPEN:listeners1:{
  sockwrite -n $sockname GET /7.html HTTP/1.0
  sockwrite -n $sockname User-Agent: Mozilla
  sockwrite -n $sockname $crlf
}
on *:sockread:listeners1:{
  if ($sockerr > 0) return
  :nextread
  sockread -f %scasttemp1
  if ($sockbr == 0) return
  if (%scasttemp1 == $null) %scasttemp1 = empty
  set %scasttemp1 $remove(%scasttemp1,<HTML><meta http-equiv="Pragma" content="no-cache"></head><body>,</body></html>)
  if ((HTTP/1.* !iswm %scasttemp1) && (content-type* !iswm %scasttemp1) && (%scasttemp1 != empty)) {
    set %status1 $gettok(%scasttemp1,2,44)    
    set %asong1 $gettok(%scasttemp1,7-,44)
    set %listeners1 $gettok(%scasttemp1,1,44)
    set %peak1 $gettok(%scasttemp1,3,44)
    set %song1 $replace(%asong1,&,$chr(38),',$chr(39))
  }
  goto nextread
}
on *:sockclose:listeners1:{
  if (%status1 == 0) {
    msg %ask.chan [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 Stream-1 Is Offline, Ask a DJ to go on [^K]8[^B])[^B]
  }
  else {
    notice %ask.nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 Listeners: %listeners1 $+ /1337 [^K]8[^B])[^B]
  }
}


;;;;;;;;;;;;;;;;;;;;;;;;;;
;override commands
;;;;;;;;;;;;;;;;;;;;;;;;;;

on 400:TEXT:@override*:# {
  if (!$2) {
    notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 Please choose a actuall @override command [^K]8[^B])[^B]
    notice $nick [^K]8,1[^B]([^B] [^K]0[^B]Example[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 @override offair [^K]8[^B])[^B]
    halt
  }
  if ($2- == requests on) {
    if (%requests == off) {
      set %requests on
      msg $chan [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 $nick turned on @requests [^K]8[^B])[^B]
    }
  }
  if ($2- == requests off) {
    if (%requests == on) {
      set %requests off
      msg $chan [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 $nick turned on @requests [^K]8[^B])[^B]
    }
  }
  if ($2- == shoutout on) {
    if (%shoutouts == off) {
      set %shoutouts on
      msg $chan [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 $nick turned on @requests [^K]8[^B])[^B]
    }
  }
  if ($2- == shoutout off) {
    if (%shoutouts == on) {
      set %shoutouts off
      msg $chan [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 $nick turned off @shoutout [^K]8[^B])[^B]
    }
  }
  if ($2- == cut on) {
    if (%cuts == off) {
      set %cuts on
      msg $chan [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 $nick turned on @cut [^K]8[^B])[^B]
    }
  }
  if ($2- == cut off) {
    if (%cuts == on) {
      set %cuts off
      msg $chan [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 $nick turned off @cut [^K]8[^B])[^B]
    }
  }
}



;;;;;;;;;;;;;;;
;;QueryScript;;
;;;;;;;;;;;;;;;

on *:OPEN:?: {
  msg $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 Hello I'm a bot for #FragRadio [^K]8[^B])[^B]
  msg $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 I will not respond to you, if you need assistance please talk to an op in #FragRadio [^K]8[^B])[^B]
  msg $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 Conversation is being closed [^K]8[^B])[^B]
  closemsg $nick
}
;;;;;;;;
;;HELP;;
;;;;;;;;
on *:TEXT:@HELP*:# {
  if ($ulevel >= 150) {
    halt
  }
  else {
    notice #fr.staff [^K]8,1[^B]-[^B]
    notice #fr.staff [^K]8,1[^B]-------------------------------[^B]
    notice #fr.staff [^K]8,1[^B]--[^K]0Nick:[^B] $nick
    notice #fr.staff [^K]8,1[^B]--[^K]0Date:[^B] $date(dddd mmmm dd $+ $chr(44) yyyy)
    notice #fr.staff [^K]8,1[^B]--[^K]0Time:[^B] $asctime(hh:nn:ss TT)
    notice #fr.staff [^K]8,1[^B]--[^K]0Channel:[^B] $chan
    notice #fr.staff [^K]8,1[^B]--[^K]0Message:[^B] $2-
    notice #fr.staff [^K]8,1[^B]-------------------------------[^B]
    notice #fr.staff [^K]8,1[^B]-[^B]
    notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 The Staff Has Been Paged [^K]8[^B])[^B]
  }
}

;;;;;;;;;;;;
;;addstaff;;
;;;;;;;;;;;;
on 400:TEXT:@addstaff*:# {
  if (!$2) {
    notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 You need to set a level [^K]8[^B])[^B]
    notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 Example: @addstaff[^B][^K]8 500[^B][^K]0 $nick CEO [^K]8[^B])[^B]
    halt
  }
  if (!$3) {
    notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 You need to set a nick [^K]8[^B])[^B]
    notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 Example: @addstaff 500 [^B][^K]8$nick[^B][^K]0 CEO [^K]8[^B])[^B]
    halt
  }
  if (!$4) {
    notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 You need to set info [^K]8[^B])[^B]
    notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 Example: @addstaff 500 $nick [^B][^K]8CEO[^B][^K]0 [^K]8[^B])[^B]
    halt
  }
  if ($2 > 300) {
    set %setlevel 350
  }
  else {
    set %setlevel 250
  }
  guser $2 $3 2 $4-
  msg chanserv #fragradio adduser $3 %setlevel
  msg chanserv #fr.staff adduser $3 200
  msg chanserv #fragradio resync
  msg chanserv #fr.staff resync
  notice $3 [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 You have been added to the staff channel [^K]8[^B])[^B]
  notice $3 [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 Put the following commands in your preform section [^K]8[^B])[^B]
  notice $3 [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 /cs inviteme #fr.staff [^K]8[^B])[^B]
  notice $3 [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 /j #fr.staff [^K]8[^B])[^B]
  notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 $3 has been added to the staff channel and fragradio channel [^K]8[^B])[^B]
}
;;;;;;;;;;;;;;;;
;;deletedstaff;;
;;;;;;;;;;;;;;;;

on 400:TEXT:@deletestaff*:# {
  if (!$2) {
    notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 You need to add a nick [^K]8[^B])[^B]
    notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 Example: @deletestaff [^B][^K]8$nick[^B] [^K]8[^B])[^B]
    halt
  }
  ruser $2 2
  msg chanserv #fragradio deluser $2
  msg chanserv #fr.staff deluser $2
  msg chanserv #fr.staff kick $2
  notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 $2 has been deleted from all the staff [^K]8[^B])[^B]
}
;;;;;;;;;;;;;;
;;djcommands;;
;;;;;;;;;;;;;;

on *:TEXT:@djcommands:# {
  if ($ulevel < 199) {
    notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 Sorry you do not have permission to access this command [^K]8[^B])[^B]
    halt
  }
  if ($ulevel > 199) {
    notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B]
    notice $nick [^K]8,1[^B]([^B] [^K]0Requests - @requests on/off [^K]8[^B])[^B]
    notice $nick [^K]8,1[^B]([^B] [^K]0Shoutouts - @shoutouts on/off [^K]8[^B])[^B]
    notice $nick [^K]8,1[^B]([^B] [^K]0Cuts - @cut on/off [^K]8[^B])[^B]
    notice $nick [^K]8,1[^B]([^B] [^K]0Onair - @onair [^K]8[^B])[^B]
    notice $nick [^K]8,1[^B]([^B] [^K]0Offair - @offair [^K]8[^B])[^B]
    notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B]
  }
}
;;;;;;;;;;;;;;;;;;;
;;managercommands;;
;;;;;;;;;;;;;;;;;;;

on *:TEXT:@managercommands:# {
  if ($ulevel < 199) {
    notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 Sorry you do not have permission to access this command [^K]8[^B])[^B]
    halt
  }
  if ($ulevel > 199) {
    notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B]
    notice $nick [^K]8,1[^B]([^B] [^K]0Override Requests - @override requests on/off [^K]8[^B])[^B]
    notice $nick [^K]8,1[^B]([^B] [^K]0Override Shoutouts - @override shoutouts on/off [^K]8[^B])[^B]
    notice $nick [^K]8,1[^B]([^B] [^K]0Override Cuts - @override cut on/off [^K]8[^B])[^B]
    notice $nick [^K]8,1[^B]([^B] [^K]0Override Offair - @override offair [^K]8[^B])[^B]
    notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B]
  }
}

;;;;;;;;;;;;;;
;;mecommands;;
;;;;;;;;;;;;;;

on *:TEXT:@ownercommands:# {
  if ($ulevel < 400) {
    notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 Sorry you do not have permission to access this command [^K]8[^B])[^B]
    halt
  }
  if ($ulevel > 400) {
    notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B]
    notice $nick [^K]8,1[^B]([^B] [^K]0Add Staff - @staff add/delete [^K]8[^B])[^B]
    notice $nick [^K]8,1[^B]([^B] [^K]0Add Sponsors - @sponsor add/delete [^K]8[^B])[^B]
    notice $nick [^K]8,1[^B]([^B] [^K]0Add Custom - @custom add/delete [^K]8[^B])[^B]
    notice $nick [^K]8,1[^B]([^B] [^K]0Bot Channels - @channel add/delete [^K]8[^B])[^B]
    notice $nick [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B]
  }
}
;;;;;;;;;
;;power;;
;;;;;;;;;
on 400:TEXT:@power:# {
  set %channelpower $chan
  pwr
}
alias pwr {
  var %s = $scon(0),%g = 1
  while (%g <= %s) {
    scid $scon(%g)
    var %f = $chan(0),%opped,%voiced,%total
    set %network $network
    inc %total $chan(0)
    while (%f) {
      if ($me isop $chan(%f)) {
        inc %opped
      }
      elseif ($me isvoice $chan(%f)) {
        inc %voiced
      }
      dec %f
      var %regular = $calc(%total - (%opped + %voiced))
    }
    inc %g
    scid -r
    msg %channelpower [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B]
    msg %channelpower [^K]8,1[^B]([^B] [^K]0[^B]Network[^B] [^K]8[^B])[^B]  [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 %network [^K]8[^B])[^B]
    msg %channelpower [^K]8,1[^B]([^B] [^K]0[^B]Total Channels[^B] [^K]8[^B])[^B]  [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 %total [^K]8[^B])[^B]
    msg %channelpower [^K]8,1[^B]([^B] [^K]0[^B]Opped Status[^B] [^K]8[^B])[^B]  [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 %opped [^K]8[^B])[^B]
    msg %channelpower [^K]8,1[^B]([^B] [^K]0[^B]Voiced Status[^B] [^K]8[^B])[^B]  [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 %voiced [^K]8[^B])[^B]
    msg %channelpower [^K]8,1[^B]([^B] [^K]0[^B]Regular Status[^B] [^K]8[^B])[^B]  [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 %regular [^K]8[^B])[^B]
    msg %channelpower [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B]
  }
  unset %network
}



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;timer Command
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
on *:SOCKOPEN:timer1:{
  sockwrite -n $sockname GET /7.html HTTP/1.0
  sockwrite -n $sockname User-Agent: Mozilla
  sockwrite -n $sockname $crlf
}
on *:sockread:timer1:{
  if ($sockerr > 0) {
    msg %ask.chan [^K]8,1[^B]([^B] [^K]0[^B]#FragRadio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 Stream-1 Is Offline, Ask a DJ to go on [^K]8[^B])[^B]
    return
  }
  :nextread
  sockread -f %scasttemp1
  if ($sockbr == 0) return
  if (%scasttemp1 == $null) %scasttemp1 = empty
  set %scasttemp1 $remove(%scasttemp1,<HTML><meta http-equiv="Pragma" content="no-cache"></head><body>,</body></html>)
  if ((HTTP/1.* !iswm %scasttemp1) && (content-type* !iswm %scasttemp1) && (%scasttemp1 != empty)) {
    set %tstatus1 $gettok(%scasttemp1,2,44)    
    set %tasong $gettok(%scasttemp1,7-,44)
    set %tlisteners1 $gettok(%scasttemp1,1,44)
    set %tpeak1 $gettok(%scasttemp1,3,44)
    set %tsong1 $replace(%asong,&,$chr(38),',$chr(39))
  }
  goto nextread
}
on *:sockclose:timer1:{
  if (%status1 == 0) {
    msg %ask.chan [^K]8,1[^B]([^B] [^K]0[^B]#Frag-Radio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 Stream-1 Is Offline, Ask a DJ to go on [^K]8[^B])[^B]
  }
  else {
    notice %ask.nick [^K]8,1[^B]([^B] [^K]0[^B]#Frag-Radio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 Stream-1: http:// $+ %serverip1 $+ : $+ %port1 $+ /listen.pls [^B]×[^B] DJ: %dj [^K]8[^B])
    notice %ask.nick [^K]8,1[^B]([^B] [^K]0[^B]#Frag-Radio[^B] [^K]8[^B])[^B] [^B][^U][^K]0×[^U][^B] [^K]8[^B]([^B][^K]0 Song: %tsong1 [^B]×[^B] Listeners: %tlisteners1 $+ /1337 [^B]×[^B] Peak: %tpeak1 [^K]8[^B])[^B]
  }
}
cut??
Posted by TrioN
Saturday, March 24, 2007 03:37pm PDT
whats cut?
egh
Posted by TrioN
Saturday, March 24, 2007 06:47pm PDT
the unfinished part is the information about the second stream
++
Posted by TrioN
Monday, March 26, 2007 05:30pm PDT
I really like this script. I updated a few parts and am going to add commands for the second stream
huh??
Posted by TrioN
Wednesday, April 04, 2007 05:33pm PDT
whats the point for the timer sock?
Subject line
Posted by chriscloyd
Tuesday, October 28, 2008 02:35pm PDT
timer so u can run a timer and it will check the server every minute
Subject line
Posted by chriscloyd
Tuesday, October 28, 2008 02:48pm PDT
timer so u can run a timer and it will check the server every minute
Submit a comment
Oops! You need to login or register before you can post a comment!

ebaum's world