All pastes #344936 Raw Edit

Stuff

public text v1 · immutable
·published 2007-02-08 03:30 UTC
rendered paste body
on *:TEXT:*:#:{
  if ($1 == .commands) { 
    msg $chan ( Commands: %commands )
  }
  if ($1 == .server1) {
    msg $chan ( Server1: %server1 )
  }
  if ($1 == .server2) {
    msg $chan ( Server2: %server2 )
  }
  if ($1 == .dj1) {
    msg $chan ( DJ1: iff(%dj1,%dj1,None) )
  }
  if ($1 == .dj2) { 
    msg $chan ( DJ2: iff(%dj2,%dj2,None) )
  }
  if ($1 == .nextdj1) {
    msg $chan ( Next DJ1: iff(%nextdj1,%nextdj1,None) )
  }
  if ($1 == .nextdj2) {
    msg $chan ( Next DJ2: iff(%nextdj2,%nextdj2,None) )
  }
  if ($1 == .song1) {
    sockclose song1
    sockopen song1 %server1ip %port1
  }
  if ($1 == .song2) {
    sockclose song2
    sockopen song2 %server2ip %port2
  }
  if ($1 == .listeners1) {
    sockclose listeners1
    sockopen listeners1 %server1ip %port1
  }
  if ($1 == .listeners2) {
    sockclose listeners2
    sockopen listeners2 %server2ip %port2
  }
  if ($1 == .request1) || ($1 == .shoutout1) { 
    if (%dj1 == $null) { 
      msg $chan ( $+(,$nick,:)There is no DJ onair at the moment please try again later. )
      halt
    }
    if (!$2) {
      msg $chan ( $+(,$nick,:)Please provide a valid $right($1,-1) $+ .
      halt
    }
    else {
      msg %dj1 $right($1,-1) from $nick $+ : $2-
      notice $nick our $right($1,-1) has been submitted.
    }
  }
  if ($1 == .request2) || ($1 == .shoutout2) { 
    if (%dj2 == $null) { 
      msg $chan ( $+(,$nick,:) There is no DJ onair at the moment please try again later. )
      halt
    }
    if (!$2) {
      msg $chan ( $+(,$nick,:) Please provide a valid $right($1,-1) $+ .
      halt
    }
    else {
      msg %dj2 $right($1,-1) from $nick $+ : $2-
      notice $nick our $right($1,-1) has been submitted.
    }
  }
  if ($1 == .set server1ip) {
    if ($nick !isop $chan) { 
      set %server1ip $3- | msg $chan ( Server 1 IP has been saved )
    }
    else { notice $nick ERROR: You must be opped }
  }
  if ($1 == .set port1) {
    if ($nick !isop $chan) { 
      set %port1 $3- | msg $chan ( Server 1 PORT has been saved )
    }
    else { notice $nick ERROR: You must be opped }
  }
  if ($1 == .set server2ip) { 
    if ($nick !isop $chan) {
      set %server2ip $3- | msg $chan ( Server 2 IP has been saved )
    }
    else { notice $nick ERROR: You must be opped }
  }
  if ($1 == .set port2) {
    if ($nick !isop $chan) {
      set %port2 $3- | msg $chan ( Server 2 PORT has been saved )
    }
    else { notice $nick ERROR: You must be opped }
  }
  if ($1 == .set commands) {
    if ($nick !isop $chan) {
      set %cmds $3- | msg $chan ( Commands have been saved )
    }
    else { notice $nick ERROR: You must be opped }
  }
  if ($1 == .set server1) {
    if ($nick !isop $chan) {
      set %server1 $3- | msg $chan ( Server 1 IP has been saved )
    }
    else { notice $nick ERROR: You must be opped }
  }
  if ($1 == .set server2) {
    if ($nick !isop $chan) {
      set %server2 $3- | msg $chan ( Server 2 IP has been saved ) 
    }
    else { notice $nick ERROR: You must be opped }
  }
  if ($1 == .set channel) {
    if ($nick !isop $chan) { 
      set %chan $3- | msg $chan ( Channel has been saved )
    }
    else { notice $nick [^B]ERROR[^B]: You must be opped }
  }
}

on *:TEXT:*:?:{
  if ($1 == .onair1) { 
    if ($nick !isop %chan) {
      msg $nick [^B]Error[^B]: You must be opped in %chan to use this command
      halt
    }
    if (%dj1 == $nick) || (%nextdj1 == $nick) {
      msg $nick You are already set as the nextdj in query for server 1
      halt
    }
    if (%nextdj1) { 
      msg $nick [^B]ERROR[^B]: There is already a dj in query for Server 1.
      halt
    }
    if (%dj1) {
      set %nextdj1 $nick
      msg $nick You have been set as the next dj in query for server 1. %dj1 is currently on.
      halt
    }
    else { 
      set %dj1 $nick
      msg $nick You are now set as onair for server 1. Requests and Shoutouts will be sent to you.
    }
  }
  if ($1 == .onair2) {
    if ($nick !isop %chan) {
      msg $nick [^B]ERROR[^B]: You must be opped in %chan to use this command
      halt
    }
    if (%dj2 == $nick) || (%nextdj2 == $nick) {
      msg $nick You are already set as the nextdj in query for server 2.
      halt
    }
    if (%nextdj2) {
      msg $nick [^B]ERROR[^B]: There is already a dj in query for server 2.
      halt
    }
    if (%dj2) {
      set %nextdj2 $nick
      msg $nick You have been set as the next dj in query for server 2. %dj2 is currently on.
    }
    else { 
      set %dj2 $nick
      msg $nick You are not set as onair for server 2. Requests and Shoutouts will be sent to you.
    }
  }
  if ($1 == .offair1) {
    if ($nick !isop %chan) {
      msg $nick [^B]ERROR[^B]: You must be opped in %chan to use this command
      halt
    }
    if (%dj1 != $nick) && (%nextdj1 != $nick) { 
      msg $nick You are not currently in the dj query for server 1. 
      halt
    }
    if (%dj1 == $nick) {
      msg %nextdj1 %dj1 is now offair. You are now the primary DJ for server 1.
      set %dj1 %nextdj1
      unset %nextdj1
      msg $nick You are now set as offair
      halt
    }
    if (%nextdj1 == $nick) {
      unset %nextdj1
      msg $nick You have been removed from the dj in query for server 2.
    }
  }
  if ($1 == .offair2) {
    if ($nick !isop $chan) {
      msg $nick [^B]ERROR[^B]: You must be opped in %chan to use this command
      halt
    }
    if (%dj2 != $nick) && (%nextdj2 != $nick) {
      msg $nick You are not currently in the dj query for server 2.
      halt
    }
    if (%dj2 == $nick) {
      msg %nextdj2 %dj2 is now offair. You are now the primary DJ for server 2.
      set %dj2 %nextdj2
      unset %nextdj2
      msg $nick You are now set as offair
      halt
    }
    if (%nextdj2 == $nick) {
      unset %nextdj2
      msg $nick You have been removed from the dj in query for server 1.
    }
  }
}

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 %song1
  if ($sockbr == 0) return
  if (%song1 == $null) %song1 = empty
  set %song1 $remove(%song1,<HTML><meta http-equiv="Pragma" content="no-cache"></head><body>,</body></html>)
  if ((HTTP/1.* !iswm %song1) && (content-type* !iswm %song1) && (%song1 != empty)) {
    set %song1 $gettok(%song1,70,44)
    set %song1 $replace(%song,&,$chr(38),',$chr(39)
  }
  goto nextread
}

on *:sockclose:song1:{
  msg %chan ( Current Song: %song1 ) 
}

on *:sockopen:song2:{
  sockwrite -n $sockname GET /7.html HTTP:/1.0
  sockwrite -n $sockname User-Agent: Mozilla
  sockwrite -n $sockname $crlf
}
on *:sockread:song2:{
  if ($sockerr > 0) return
  :nextread
  sockwrite -f %song2
  if ($sockbr == 0) return
  if (%song2 == $null) %song2 = empty
  set %song2 $remove(%song2,<HTML><meta http-equiv="Praga" content="no-cache"></head><body>,</body></html>)
  if ((HTTP/1.* !iswm %song2) && (content-type* !iswm %song2) && (%song2 != empty)) {
    set %song2 $gettok(%song2,70,44)
    set %song2 $replace(%song2,&,$chr(38),',$chr(39))
  }
  goto nextread
}
on *:sockclose:song2:{
  msg $chan ( Current Song: %song2 )
}

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 %listeners1
  if ($sockbr == 0) return
  if (%listeners1 == $null) %listeners1 = empty
  set %listeners1 $remove(%listeners1,<HTML><meta http-equiv="Pragma" content="no-cache"></head><body>,</body></html>)
  if ((HTTP/1.* !iswm %listeners1) && (content-type* !iswm %listeners1) && (%listeners1 != empty)) {
    set %listeners1 $gettok(%listeners1,1,44)
  }
  goto nextread
}

on *:sockclose:listeners1:{
  msg %chan ( Listeners: %listeners1 )
}

on *:sockopen:listeners2:{
  sockwrite -n $sockname GET /7.html HTTP/1.0
  sockwrite -n $sockname User-Agent: Mozilla
  sockwrite -n $sockname $crlf
}
on *:sockread:listeners2:{
  if ($sockerr > 0) return
  :nextread
  sockread -n %listeners2
  if ($sockbr == 0) return
  if (%listeners2 == $null) %listeners2 == empty
  set %listeners2 $remove(%listeners2,<HTML><meta http-equiv="Pragma" content="no-cache"></head><body>,</body></html>
  if ((HTTP/1.* !iswm %listeners2) && (content-type* !iswm %listeners2) && (%listeners2 != empty)) {
    set %listeners2 $gettok(%listeners2,1,44)
  }
  goto nextread
}
on *:sockclose:listeners2:{
  msg %chan ( Listeners: %listeners2 )
}

alias topic {
  topic %chan ( Kurupt.Radio .x. Server1:$+ %dj1 $+ .x. Server2: $+ %dj2 $+ )
}

on *:TEXT:.topic*:%chan:{
  if ($nick !isop $chan) {
    dotopic
  }
  else { HALT }
} 

on *:nick:{
  if ($nick == %dj1) {
    set %dj1 $newnick
  }
  if ($nick == %dj2) {
    set %dj2 $newnick
  }
  if ($nick == %nextdj1) {
    set %nextdj1 $newnick
  }
  if ($nick == %nextdj2) {
    set %nextdj2 $newnick
  }
}

on *:part:%chan:{
  if ($nick == %dj1) {
    msg %nextdj1 %dj1 is now offair. you are now the primary DJ for server 1.
    msg %dj You are now set as offair for parting the channel for server 1.
    set %dj1 %nextdj1
    unset %nextdj1
    halt
  }
  if ($nick == %nextdj1) {
    msg %nextdj1 You have been removed from the DJ query for parting the channel for servet 1.
    unset %nextdj1
  }
  if ($nick == %dj2) {
    msg %nextdj2 %dj2 is now offair. you are now the primary DJ for server 2.
    msg %dj2 You are now set as offair for parting the channel for server 2.
    set %dj2 %nextdj2
    unset %nextdj2
    halt
  }
  if ($nick == %nextdj2) {
    msg %nextdj2 You have been removed from the DJ query for parting the channel for server 2.
    unset %nextdj2
  }