All pastes #1207127 Raw Edit

Radio Bot - Storm Network

public text v1 · immutable
#1207127 ·published 2008-09-21 03:00 UTC
rendered paste body
on *:load:{
  set %chan #stormnetwork
}
on *:JOIN:%chan:{
  timer 1 1 notice $nick Welcome to %channel !
  timer 1 1 notice $nick Type @commands to see a list of commands.
  timer 1 2 notice $nick If you want the bot in your channel type @apply !
}
on *:NICK:#:{
  if ($nick == %dj) {
    set %dj $newnick
    amsg DJ $+ $nick changed his name to $newnick
  } 
}
on *:TEXT:@commands:#:{
  notice $nick Storm Network Radio
  timer 1 1 notice $nick Stream - @stream
  timer 1 2 notice $nick Song - @song
  timer 1 3 notice $nick Listeners - @listeners
  timer 1 4 notice $nick DJ - @dj
  timer 1 5 notice $nick Shoutout - @shoutout
  timer 1 6 notice $nick Request - @request
  timer 1 7 notice $nick Cut - @cut
  timer 1 8 notice $nick #StormNetwork
}
on *:TEXT:@dj:#:{
  if (%dj) {
    if ($nick == %dj) {
      notice $nick You're the DJ right now.
    }
    else {
      notice $nick DJ %dj is the DJ right now.
    }
  }
  else {
    notice $nick No DJ at the moment.
  }
}
on 200:TEXT:@onair:#:{
  if ($nick == %dj) {
    notice $nick You are already on air.
    halt
  }
  if (%dj) {
    notice $nick DJ %dj is the DJ right now.
    halt
  }  
  if (!%dj) {
    set %dj $nick
    msg $chan DJ %dj is now on air.
  }
}
on 200:TEXT:@offair:#:{
  if (%dj) {
    if ($nick == %dj) {
      set %requests on
      set %shoutouts on
      set %cuts on
      notice $nick DJ %dj is now off air.
      amsg DJ %dj is now off air.
      unset %dj
    }
  }
}
on *:TEXT:@shoutout*:#:{
  if (!%dj) {
    notice $nick Stream is offline.
  }
  else {
    if (!$2) {
      notice $nick You didn't submit a shoutout.
    }
    else {
      if ($2 == on) {
        if ($nick == %dj) {
          set %shoutouts on
          notice $nick You turned on shoutouts !
          msg $chan DJ %dj has turned on shoutouts.
          halt
        }
      }
      if ($2 == off) {
        if ($nick == %dj) {
          set %shoutouts off
          notice $nick You turned off shoutouts !
          msg $chan DJ %dj has turned off shoutouts.
          halt
        }
      }
      if (%shoutouts == off) {
        notice $nick This command was turned off by DJ %dj
        halt
      }
      if (%spam.shoutouts. [ $+ [ $nick ] ] == 1) {
        notice $nick You can only used this command once every minute.
        halt
      }
      else {
        set -u60 %spam.shoutouts. [ $+ [ $nick ] ] 1
        if ($nick == %dj) {
          notice $nick You can't send a shoutout to yourself.
        }
        else {
          notice $nick Your shoutout has been sent to DJ %dj !
          msg %dj Shoutout by $nick $+ :  $2-
        }
      }
    }
  }
}
on *:TEXT:@request*:#:{
  if (!%dj) {
    notice $nick Stream is offline.
  }
  else {
    if (!$2) {
      notice $nick You didn't submit a request.
    }
    else {
      if ($2 == on) {
        if ($nick == %dj) {
          set %requests on
          notice $nick You turned on request.
          msg $chan DJ %dj has turned on request.
          halt
        }
      }
      if ($2 == off) {
        if ($nick == %dj) {
          set %requests off
          notice $nick You turned off request.
          msg $chan DJ %dj has turned off request.
          halt
        }
      }
      if (%requests == off) {
        notice $nick This command was turned off by DJ %dj
        halt
      }
      if (%spam.request. [ $+ [ $nick ] ] == 1) {
        notice $nick You can only used this command once every minute.
        halt
      }
      else {
        set -u60 %spam.request. [ $+ [ $nick ] ] 1
        if ($nick == %dj) {
          notice $nick You can't send a request to yourself.
        }
        else {
          notice $nick Your request has been sent to DJ %dj !
          msg %dj Request by $nick $+ :  $2-
        }
      }
    }
  }
}
on *:TEXT:@cut*:#:{
  if (!%dj) {
    notice $nick Stream is offline.
  }
  else {
    if ($2 == on) {
      if ($nick == %dj) {
        set %cuts on
        notice $nick You turned on cut.
        msg $chan DJ %dj has turned on cut.
        halt
      }
    }
    elseif ($2 == off) {
      if ($nick == %dj) {
        set %cuts off
        notice $nick You turned off cut.
        msg $chan DJ %dj has turned off cut.
        halt
      }
    }
    else {
      if (%cuts == off) {
        notice $nick This command was turned off by DJ %dj
        halt
      }
      if (%spam.cuts. [ $+ [ $nick ] ] == 1) {
        notice $nick You can only used this command once every minute.
        halt
      }
      else {
        set -u60 %spam.cuts. [ $+ [ $nick ] ] 1
        if ($nick == %dj) {
          notice $nick You can't cut yourself.
        }
        else {
          notice $nick Your cut request has been sent to DJ %dj !
          msg %dj Request to cut the song has been sent by $nick
        }
      }
    }
  }
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;@server Command
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



on *:TEXT:@stream:#:{
  if (%dj) { 
    set %ask.nick $nick
    set %ask.chan $chan
    sockclose server1
    sockopen server1 %serverip1 %port1
  }
  else {
    notice $nick Stream is offline.
  }
}
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 Stream is offline.
    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 Stream is offline.
  }
  else {
    notice %ask.nick Stream : http:// $+ %serverip1 $+ : $+ %port1 $+ /listen.pls DJ: %dj
    notice %ask.nick Song: %song1 × Listeners: %listeners1 $+ /1337 × Peak: %peak1
  }
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;@server Command
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



on *:TEXT:@song:#:{
  if (!%dj) { notice $nick Stream is offline. | 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 Stream is offline.
  }
  else {
    notice %ask.nick Song: %song1
  }
}



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



on *:TEXT:@listeners:#:{
  if (!%dj) { notice $nick Stream is offline. | 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 Stream is offline.
  }
  else {
    notice %ask.nick Listeners: %listeners1 $+ /1337
  }
}


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

on 400:TEXT:@override*:#:{
  if (!$2) {
    notice $nick Please choose a override command.
    halt
  }
  if ($2- == requests on) {
    if (%requests == off) {
      set %requests on
      msg $chan $nick has turned on requests.
    }
  }
  if ($2- == requests off) {
    if (%requests == on) {
      set %requests off
      msg $chan $nick has turned off requests.
    }
  }
  if ($2- == shoutout on) {
    if (%shoutouts == off) {
      set %shoutouts on
      msg $chan $nick has turned on requests.
    }
  }
  if ($2- == shoutout off) {
    if (%shoutouts == on) {
      set %shoutouts off
      msg $chan $nick has turned off shoutout.
    }
  }
  if ($2- == shoutout on) {
    if (%shoutouts == off) {
      set %shoutouts on
      msg $chan $nick has turned on shoutout.
    }
  }
  if ($2- == cut on) {
    if (%cuts == off) {
      set %cuts on
      msg $chan $nick has turned on cut.
    }
  }
  if ($2- == cut off) {
    if (%cuts == on) {
      set %cuts off
      msg $chan $nick has turned off cut.
    }
  }
}



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

on *:OPEN:?:{
  msg $nick Hello $nick , i'm a bot for %chan !
  msg $nick I will not respond to you, if you need assistance please talk to an op in %chan !
  msg $nick Conversation is being closed.
  closemsg $nick
}
;;;;;;;;
;;HELP;;
;;;;;;;;
on *:TEXT:@HELP*:#:{
  if ($ulevel >= 150) {
    halt
  }
  else {
    notice %support -------------------------------
    notice %support Nick : $nick
    notice %support Date : $date(dddd mmmm dd $+ $chr(44) yyyy)
    notice %support Time : $asctime(hh:nn:ss TT)
    notice %support Channel : $chan
    notice %support Message : $2-
    notice %support -------------------------------
    notice $nick The staff has been paged !
  }
}

;;;;;;;;;;;;
;;addstaff;;
;;;;;;;;;;;;
on 400:TEXT:@addstaff*:#:{
  if (!$2) {
    notice $nick You need to set a level.
    notice $nick Example : @addstaff 500 $nick CEO
    halt
  }
  if (!$3) {
    notice $nick You need to set a nick.
    notice $nick Example : @addstaff 500 $nick CEO
    halt
  }
  if (!$4) {
    notice $nick You need to set info.
    notice $nick Example: @addstaff 500 $nick CEO
    halt
  }
  if ($2 > 300) {
    set %setlevel 350
  }
  else {
    set %setlevel 250
  }
  guser $2 $3 2 $4-
  msg chanserv %chan adduser $3 %setlevel
  msg chanserv %support adduser $3 200
  msg chanserv %chan resync
  msg chanserv %support resync
  notice $3 You have been added to the staff channel.
  notice $3 Put the following commands in your preform section.
  notice $3 /cs inviteme %support
  notice $3 /j %support
  notice $nick $3 has been added to the staff channel and the storm network channel.
}
;;;;;;;;;;;;;;;;
;;deletedstaff;;
;;;;;;;;;;;;;;;;

on 400:TEXT:@deletestaff*:#:{
  if (!$2) {
    notice $nick You need to add a nick.
    notice $nick Example: @deletestaff $nick 
    halt
  }
  ruser $2 2
  msg chanserv %chan deluser $2
  msg chanserv %support deluser $2
  msg chanserv %support kick $2
  notice $nick $2 has been deleted.
}
;;;;;;;;;;;;;;
;;djcommands;;
;;;;;;;;;;;;;;

on *:TEXT:@djcommands:#:{
  if ($ulevel < 199) {
    notice $nick Sorry you don't have permission to access this command.
    halt
  }
  if ($ulevel > 199) {
    notice $nick Storm Network Radio - DJ Commands
    notice $nick Requests - @requests on/off
    notice $nick Shoutouts - @shoutouts on/off
    notice $nick Cuts - @cut on/off
    notice $nick Onair - @onair
    notice $nick Offair - @offair
  }
}
;;;;;;;;;;;;;;;;;;;
;;managercommands;;
;;;;;;;;;;;;;;;;;;;

on *:TEXT:@managercommands:#:{
  if ($ulevel < 199) {
    notice $nick Sorry you don't have permission to access this command.
    halt
  }
  if ($ulevel > 199) {
    notice $nick Storm Network Radio - Manager Commands
    notice $nick Override Requests - @override requests on/off
    notice $nick Override Shoutouts - @override shoutouts on/off
    notice $nick Override Cuts - @override cut on/off
    notice $nick Override Offair - @override offair
  }
}

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

on *:TEXT:@ownercommands:#:{
  if ($ulevel < 400) {
    notice $nick Sorry you don't have permission to access this command.
    halt
  }
  if ($ulevel > 400) {
    notice $nick Storm Network Radio - Owner Commands
    notice $nick Add Staff - @staff add/delete
    notice $nick Add Sponsors - @sponsor add/delete
    notice $nick Add Custom - @custom add/delete
    notice $nick Bot Channels - @channel add/delete
  }
}
;;;;;;;;;
;;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
    timer 1 1 msg %channelpower Network : %network
    timer 1 2 msg %channelpower Nick : $me
    timer 1 3 msg %channelpower Email : $email
    timer 1 4 msg %channelpower Address : $address
    timer 1 5 msg %channelpower Total Channels : %total
    timer 1 6 msg %channelpower Opped Status : %opped
    timer 1 7 msg %channelpower Voiced Status : %voiced
    timer 1 8 msg %channelpower Regular Status : %regular
  } 
  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 Stream is offline.
    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 Stream is offline.
  }
  else {
    notice %ask.nick Stream : http:// $+ %serverip1 $+ : $+ %port1 $+ /listen.pls × DJ : %dj
    notice %ask.nick Song : %tsong1 × Listeners : %tlisteners1 $+ /1337 × Peak : %tpeak1
  }
}