Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ON *:JOIN:#chaotic-radio: { ; by westor 15/062015
- if ($nick != $me) { mode $chan +v $nick }
- elseif ($nick == $me) { set %radio 1 | radio_start }
- }
- ON *:PART:#chaotic-radio: { if ($nick == $me) { radio_stop } } ; by westor 15/062015
- ON *:KICK:#chaotic-radio: { if ($knick == $me) { radio_stop } } ; by westor 15/062015
- alias cols { return $iif(%radio_color_start,$v1,10) } ; by westor 15/062015
- alias cole { return $iif(%radio_color_end,$v1,11) } ; by westor 15/062015
- ON *:TEXT:!*:#chaotic-radio: { ; by westor 15/062015
- tokenize 32 $strip($1-)
- if ($1 == !radiocolorstart) {
- if ($nick !isop $chan) { .msg $chan ( $+ $nick $+ ): You are NOT an channel moderator! | return }
- if ($2 == $null) { .msg $chan ( $+ $nick $+ ): Error, Please specify a color number! | return }
- if ($2 !isnum) { .msg $chan ( $+ $nick $+ ): Error, Please specify valid port! | return }
- if ($2 == %radio_color_end) { .msg $chan ( $+ $nick $+ ): Error, Incorrect parameter, Please specify an other color this color has been set for end! | return }
- if ($2 == %radio_color_start) { .msg $chan ( $+ $nick $+ ): Error, Already the same, Please use an other color number! | return }
- if ($2 > 15) { .msg $chan ( $+ $nick $+ ): Error, Too high parameter, Please specify only from 0-15 number! | return }
- set %radio_color_start $2
- .msg $chan ( $+ $nick $+ ): The Radio ShoutCast start color has been set.
- }
- if ($1 == !radiocolorend) {
- if ($nick !isop $chan) { .msg $chan ( $+ $nick $+ ): You are NOT an channel moderator! | return }
- if ($2 == $null) { .msg $chan ( $+ $nick $+ ): Error, Please specify a color number! | return }
- if ($2 !isnum) { .msg $chan ( $+ $nick $+ ): Error, Please specify valid port! | return }
- if ($2 == %radio_color_start) { .msg $chan ( $+ $nick $+ ): Error, Incorrect parameter, Please specify an other color this color has been set for start! | return }
- if ($2 == %radio_color_end) { .msg $chan ( $+ $nick $+ ): Error, Already the same, Please use an other color number! | return }
- if ($2 > 15) { .msg $chan ( $+ $nick $+ ): Error, Too high parameter, Please specify only from 0-15 number! | return }
- set %radio_color_end $2
- .msg $chan ( $+ $nick $+ ): The Radio ShoutCast end color has been set.
- }
- if ($1 == !radiohost) || ($1 == !radioip) {
- if ($nick !isop $chan) { .msg $chan ( $+ $nick $+ ): You are NOT an channel moderator! | return }
- if (!$2) { .msg $chan ( $+ $nick $+ ): Error, Please specify a host/ip! | return }
- if (*:* iswm $2) { .msg $chan ( $+ $nick $+ ): Error, Please specify only an host/ip address without the port! | return }
- if ($2 == %radio_ip) { .msg $chan ( $+ $nick $+ ): Error, Already the same, Please specify an other value! | return }
- radio_stop
- set %radio_ip $2
- .msg $chan ( $+ $nick $+ ): The ShoutCast Radio host/ip has been set successfully.
- }
- if ($1 == !radioport) {
- if ($nick !isop $chan) { .msg $chan ( $+ $nick $+ ): You are NOT an channel moderator! | return }
- if (!$2) { .msg $chan ( $+ $nick $+ ): Error, Please specify an port! | return }
- if ($2 !isnum) { .msg $chan ( $+ $nick $+ ): Error, Please specify valid port! | return }
- if ($2 == %radio_port) { .msg $chan ( $+ $nick $+ ): Error, Already the same, Please specify an other value! | return }
- radio_stop
- set %radio_port $2
- .msg $chan ( $+ $nick $+ ): The ShoutCast Radio port has been set successfully.
- }
- if ($1 == !radiostart) || ($1 == !radion) {
- if ($nick !isop $chan) { .msg $chan ( $+ $nick $+ ): You are NOT an channel moderator! | return }
- if (%radio) { .msg $chan ( $+ $nick $+ ): Error, Already running! | return }
- set %radio 1
- .msg $chan ( $+ $nick $+ ): The ShoutCast Radio auto announce has been started.
- radio_start
- }
- if ($1 == !radiostop) || ($1 == !radioff) {
- if ($nick !isop $chan) { .msg $chan ( $+ $nick $+ ): You are NOT an channel moderator! | return }
- if (!%radio) { .msg $chan ( $+ $nick $+ ): Error, Not running! | return }
- radio_stop
- .msg $chan ( $+ $nick $+ ): The ShoutCast Radio auto announce has been stopped.
- }
- if ($1 == !lastsong) {
- var %lsong = $hget(RADIO,LASTSONG)
- if (!%lsong) { .msg $chan ( $+ $nick $+ ): There is NOT any last song yet played! | return }
- .msg $chan ( $+ $nick $+ ): $+ $cols $+ Last Played Song - $+ $cole $+ $+ %lsong $+
- }
- if ($1 == !song) {
- var %err = $get_radio
- if (%err == 1) { radio_stop | .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio IP or Port are incorrect or not set! | return }
- if (%err == 2) { radio_stop | .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio IP or Port are incorrect, or an connection problem has been occurred! | return }
- var %st = $hget(RADIO,STATUS)
- if (!%st) { .msg $chan ( $+ $nick $+ ): The ShoutCast Radio is currently offline! | return }
- var %song = $hget(RADIO,SONG)
- .msg $chan ( $+ $nick $+ ): $+ $cols $+ Now Playing - $+ $cole $+ $+ $iif(%song,$v1,N/A) $+
- }
- if ($1 == !radiotopic) {
- if (!$2) { .msg $chan ( $+ $nick $+ ): Error, Please specify a text! | return }
- radio_topic $2-
- .msg $chan ( $+ $nick $+ ): The topic has been successfully set.
- }
- if ($1 == !radiostatus) {
- var %err = $get_radio
- if (%err == 1) { radio_stop | .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio IP or Port are incorrect or not set! | return }
- if (%err == 2) { radio_stop | .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio IP or Port are incorrect, or an connection problem has been occurred! | return }
- var %st = $hget(RADIO,STATUS)
- if (!%st) { .msg $chan ( $+ $nick $+ ): The ShoutCast Radio is currently offline! - (Radio IP: $+ $iif(%radio_ip,$v1,N/A) $+ ) - (Radio Port: $+ $iif(%radio_port,$v1,N/A) $+ ) }
- elseif (%st) { .msg $chan ( $+ $nick $+ ): The ShoutCast Radio is currently online. - (Radio IP: $+ $iif(%radio_ip,$v1,N/A) $+ ) - (Radio Port: $+ $iif(%radio_port,$v1,N/A) $+ ) }
- }
- if ($1 == !listeners) {
- var %err = $get_radio
- if (%err == 1) { radio_stop | .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio IP or Port are incorrect or not set! | return }
- if (%err == 2) { radio_stop | .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio IP or Port are incorrect, or an connection problem has been occurred! | return }
- var %st = $hget(RADIO,STATUS)
- if (!%st) { .msg $chan ( $+ $nick $+ ): The ShoutCast Radio is currently offline! | return }
- var %max_l = $iif($hget(RADIO,MAXLISTENERS),$v1,0)
- var %listeners = $iif($hget(RADIO,LISTENERS),$v1,0)
- .msg $chan ( $+ $nick $+ ): $+ $cols $+ Listener(s) - $+ $cole $+ $+ %listeners $+ $+ $cols $+ / $+ $cole $+ $+ %max_l $+
- }
- if ($1 == !peak) {
- var %err = $get_radio
- if (%err == 1) { radio_stop | .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio IP or Port are incorrect or not set! | return }
- if (%err == 2) { radio_stop | .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio IP or Port are incorrect, or an connection problem has been occurred! | return }
- var %peak = $hget(RADIO,PEAK)
- if (!%peak) { .msg $chan ( $+ $nick $+ ): There is NOT any peak made yet! }
- elseif (%peak) { .msg $chan ( $+ $nick $+ ): $+ $cols $+ Peak Listener(s) - $+ $cole $+ $+ %peak $+ }
- }
- if ($1 == !dj) {
- var %err = $get_radio
- if (%err == 1) { radio_stop | .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio IP or Port are incorrect or not set! | return }
- if (%err == 2) { radio_stop | .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio IP or Port are incorrect, or an connection problem has been occurred! | return }
- var %st = $hget(RADIO,STATUS)
- if (!%st) { .msg $chan ( $+ $nick $+ ): The ShoutCast Radio is currently offline! | return }
- var %dj = $hget(RADIO,DJ)
- if (!%dj) { .msg $chan ( $+ $nick $+ ): There is NOT any DJ yet on the descs! }
- elseif (%dj) { .msg $chan ( $+ $nick $+ ): $+ $cols $+ Currently DJ - $+ $cole $+ $+ %dj $+ }
- }
- if ($1 == !genre) {
- var %err = $get_radio
- if (%err == 1) { radio_stop | .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio IP or Port are incorrect or not set! | return }
- if (%err == 2) { radio_stop | .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio IP or Port are incorrect, or an connection problem has been occurred! | return }
- var %st = $hget(RADIO,STATUS)
- if (!%st) { .msg $chan ( $+ $nick $+ ): The ShoutCast Radio is currently offline! | return }
- var %genre = $hget(RADIO,GENRE)
- if (!%genre) { .msg $chan ( $+ $nick $+ ): There is NOT any GENRE yet has been set on the radio! }
- elseif (%genre) { .msg $chan ( $+ $nick $+ ): $+ $cols $+ Currently Genre - $+ $cole $+ $+ %genre $+ }
- }
- if ($1 == !radiouptime) {
- var %err = $get_radio
- if (%err == 1) { radio_stop | .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio IP or Port are incorrect or not set! | return }
- if (%err == 2) { radio_stop | .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio IP or Port are incorrect, or an connection problem has been occurred! | return }
- var %st = $hget(RADIO,STATUS)
- if (!%st) { .msg $chan ( $+ $nick $+ ): The ShoutCast Radio is currently offline! | return }
- var %uptime = $hget(RADIO,UPTIME)
- if (!%uptime) { .msg $chan ( $+ $nick $+ ): The ShoutCast Radio is NOT online! }
- elseif (%uptime) { .msg $chan ( $+ $nick $+ ): $+ $cols $+ The ShoutCast Radio uptime is: $+ $cole $+ $+ $duration(%uptime) $+ }
- }
- if ($1 == !bitrate) || ($1 == !bits) || ($1 == !bitrates) {
- var %err = $get_radio
- if (%err == 1) { radio_stop | .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio IP or Port are incorrect or not set! | return }
- if (%err == 2) { radio_stop | .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio IP or Port are incorrect, or an connection problem has been occurred! | return }
- var %st = $hget(RADIO,STATUS)
- if (!%st) { .msg $chan ( $+ $nick $+ ): The ShoutCast Radio is currently offline! | return }
- var %bits = $hget(RADIO,BITRATE)
- if (!%bits) { .msg $chan ( $+ $nick $+ ): The ShoutCast Radio is NOT online! }
- elseif (%bits) { .msg $chan ( $+ $nick $+ ): $+ $cols $+ Radio Bitrate - $+ $cole $+ $+ %bits $+ kbps $+ }
- }
- if ($1 == !listen) || ($1 == !tune) {
- if (!%radio_ip) { .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio does not has an IP/Host set! | return }
- if (!%radio_port) { .msg $chan ( $+ $Nick $+ ): Error, The ShoutCast Radio does NOT has an Port set! | return }
- .msg $chan ( $+ $nick $+ ): $+ $cols $+ Listen us now from - $+ $cole $+ $+ http:// $+ %radio_ip $+ : $+ %radio_port $+ /listen.pls $+
- }
- if ($1 == !info) || ($1 == !np) || ($1 == !stats) {
- var %err = $get_radio
- if (%err == 1) { radio_stop | .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio IP or Port are incorrect or not set! | return }
- if (%err == 2) { radio_stop | .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio IP or Port are incorrect, or an connection problem has been occurred! | return }
- var %st = $hget(RADIO,STATUS)
- if (!%st) { .msg $chan ( $+ $nick $+ ): The ShoutCast Radio is currently offline! | return }
- var %dj = $iif($hget(RADIO,DJ),$v1,N/A)
- var %song = $iif($hget(RADIO,SONG),$v1,N/A)
- var %bits = $iif($hget(RADIO,BITRATE),$v1,0)
- var %max_l = $iif($hget(RADIO,MAXLISTENERS),$v1,0)
- var %listeners = $iif($hget(RADIO,LISTENERS),$v1,0)
- var %genre = $iif($hget(RADIO,GENRE),$v1,N/A)
- var %uptime = $iif($hget(RADIO,UPTIME),$duration($v1),N/A)
- .msg $chan ( $+ $nick $+ ): $+ $cols $+ Now Playing - $+ $cole $+ $+ %song $+ $+ $cols - DJ: $+ $cole $+ $+ %dj $+ $+ $cols - Listener(s): $+ $cole $+ $+ %listeners $+ $+ $cols $+ / $+ $cole $+ $+ %max_l $+ $+ $cols - Genre: $+ $cole $+ $+ %genre $+ $+ $cols - Bitrate: $+ $cole $+ $+ %bits $+ Kbps $+ $+ $cols - Stream Uptime: $+ $cole $+ $+ %uptime $+ $+ $cols - Listen live from: $+ $cole $+ $+ http:// $+ %radio_ip $+ : $+ %radio_port $+ /listen.pls $+
- }
- if ($1 == !radiohelp) { .msg $chan ( $+ $Nick $+ : Radio Commands are: !song - !dj - !genre - !lastsong - !peak - !listeners - !bits - !info - !listen - !radiostatus - !radiotopic - !radiouptime - !radiostart - !radiostop - !radiocolorstart - !radiocolorend - !radioip - !radioport }
- }
- alias radio_topic { ; by westor 15/062015
- if (!$1-) { return }
- var %chan = #chaotic-radio
- var %t = $scon(0)
- var %i = 1
- while (%i <= %t) {
- var %s = $scon(%i).cid
- if ($scid(%s).status == connected) {
- var %chans = $mchans(%s)
- var %old = $mtopic(%s,%chan)
- var %new = $strip($1-)
- if (%chans) && ($istok(%chans,%chan,44)) {
- if (%old !== %new) { scid %s .topic %chan $1- }
- }
- }
- inc %i
- }
- }
- alias radio_msg { ; by westor 15/062015
- if (!$1-) { return }
- var %chan = #chaotic-radio
- var %t = $scon(0)
- var %i = 1
- while (%i <= %t) {
- var %s = $scon(%i).cid
- if ($scid(%s).status == connected) {
- var %chans = $mchans(%s)
- if (%chans) && ($istok(%chans,%chan,44)) { scid %s .msg %chan $1- }
- }
- inc %i
- }
- }
- alias mchans { ; by westor 15/062015
- if (!$1) { return }
- scid $1
- var %t = $chan(0)
- var %i = 1
- while (%i <= %t) {
- var %c = $chan(%i)
- if ($me isop %c) { var %tot = $addtok(%tot,%c,44) }
- inc %i
- }
- if (%tot) { return %tot }
- elseif (!%tot) { return 0 }
- }
- alias mtopic { ; by westor 15/062015
- if (!$1) && (!$2) { return }
- scid $1
- if ($me isop $2) { var %top = $strip($chan($2).topic) }
- if (%top) { return %top }
- elseif (!%top) { return 0 }
- }
- alias radio_say { ; by westor 15/062015
- if ($status !== connected) { return }
- var %old = $hget(RADIO,SONG)
- var %err = $get_radio
- if (%err == 1) {
- radio_stop
- radio_msg Error, The ShoutCast Radio IP or Port are incorrect or not set, the auto announce has been stopped!
- return
- }
- if (%err == 2) {
- radio_stop
- radio_msg Error, The ShoutCast Radio IP or Port are incorrect, or an connection problem has been occurred, the auto announce has been stopped!
- return
- }
- var %st = $hget(RADIO,STATUS)
- if (!%st) {
- if ($hget(RADIO,STOP)) { return }
- hadd -m RADIO STOP 1
- if ($hget(RADIO,TOPIC)) { hdel RADIO TOPIC }
- radio_msg The ShoutCast Radio is currently offline!
- radio_topic $+ $cole $+ ,1[ $+ $cols $+ Chaotic-Radio is $+ $cole $+ Offline $+ $cols :( $+ $cole $+ ]
- return
- }
- if ($hget(RADIO,STOP)) { hdel RADIO STOP }
- var %new = $hget(RADIO,SONG)
- var %dj = $iif($hget(RADIO,DJ),$v1,N/A)
- var %song = $iif($hget(RADIO,SONG),$v1,N/A)
- var %bits = $iif($hget(RADIO,BITRATE),$v1,0)
- var %max_l = $iif($hget(RADIO,MAXLISTENERS),$v1,0)
- var %listeners = $iif($hget(RADIO,LISTENERS),$v1,0)
- var %genre = $iif($hget(RADIO,GENRE),$v1,N/A)
- var %uptime = $iif($hget(RADIO,UPTIME),$duration($v1),N/A)
- if (!$hget(RADIO,TOPIC)) { hadd -m RADIO TOPIC 1 | radio_topic $+ $cole $+ ,1[ $+ $cols $+ Chaotic-Radio is $+ $cole $+ Online $+ $cols :) $+ $cole $+ ] }
- if (%old) && (%old !== %new) { hadd -m RADIO LASTSONG %old }
- if (%old !== %new) { radio_msg $+ $cols $+ Now Playing - $+ $cole $+ $+ %song $+ $+ $cols - DJ: $+ $cole $+ $+ %dj $+ $+ $cols - Listener(s): $+ $cole $+ $+ %listeners $+ $+ $cols $+ / $+ $cole $+ $+ %max_l $+ $+ $cols - Genre: $+ $cole $+ $+ %genre $+ $+ $cols - Bitrate: $+ $cole $+ $+ %bits $+ Kbps $+ $+ $cols - Stream Uptime: $+ $cole $+ $+ %uptime $+ $+ $cols - Listen live from: $+ $cole $+ $+ http:// $+ %radio_ip $+ : $+ %radio_port $+ /listen.pls $+ }
- }
- alias radio_stop { ; by westor 15/062015
- unset %radio
- .timer[RADIO_AUTO] off
- if ($hget(RADIO)) { hfree $v1 }
- }
- alias radio_start { ; by westor 15/062015
- if ($status !== connected) { return }
- if (!%radio) { return }
- if ($hget(RADIO)) { hfree $v1 }
- .timer[RADIO_AUTO] 0 10 radio_say
- }
- alias get_radio { ; by westor 15/062015
- if ($status !== connected) { return }
- if (!%radio_ip) && (!%radio_port) {
- if ($isid) { return 1 }
- return
- }
- var %v = radio_ $+ $ticks $+ $ctime
- var %u = http:// $+ %radio_ip $+ : $+ %radio_port $+ /statistics?json=1&nocache= $+ $ticks
- JSONOpen -du %v %u
- if ($JSONError) {
- if ($isid) { return 2 }
- return
- }
- hadd -m RADIO STATUS $json(%v,streams,0,streamstatus)
- hadd -m RADIO PEAK $json(%v,streams,0,peaklisteners)
- hadd -m RADIO SONG $json(%v,streams,0,songtitle)
- hadd -m RADIO DJ $json(%v,streams,0,dj)
- hadd -m RADIO GENRE $json(%v,streams,0,servergenre)
- hadd -m RADIO UPTIME $json(%v,streams,0,streamuptime)
- hadd -m RADIO BITRATE $json(%v,streams,0,bitrate)
- hadd -m RADIO LISTENERS $json(%v,streams,0,currentlisteners)
- hadd -m RADIO MAXLISTENERS $json(%v,streams,0,maxlisteners)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement