Advertisement
westor

ShoutCast Radio Bot v3.0 for Wikked

Jun 15th, 2015
574
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 16.93 KB | None | 0 0
  1. ON *:JOIN:#chaotic-radio: { ; by westor 15/062015
  2.   if ($nick != $me) { mode $chan +v $nick }
  3.   elseif ($nick == $me) { set %radio 1 | radio_start }
  4. }
  5. ON *:PART:#chaotic-radio: { if ($nick == $me) { radio_stop } } ; by westor 15/062015
  6. ON *:KICK:#chaotic-radio: { if ($knick == $me) { radio_stop } } ; by westor 15/062015
  7.  
  8. alias cols { return $iif(%radio_color_start,$v1,10) } ; by westor 15/062015
  9. alias cole { return $iif(%radio_color_end,$v1,11) } ; by westor 15/062015
  10.  
  11. ON *:TEXT:!*:#chaotic-radio: { ; by westor 15/062015
  12.   tokenize 32 $strip($1-)
  13.   if ($1 == !radiocolorstart) {
  14.     if ($nick !isop $chan) { .msg $chan ( $+ $nick $+ ): You are NOT an channel moderator! | return }
  15.     if ($2 == $null) { .msg $chan ( $+ $nick $+ ): Error, Please specify a color number! | return }
  16.     if ($2 !isnum) { .msg $chan ( $+ $nick $+ ): Error, Please specify valid port! | return }
  17.     if ($2 == %radio_color_end) { .msg $chan ( $+ $nick $+ ): Error, Incorrect parameter, Please specify an other color this color has been set for end! | return }
  18.     if ($2 == %radio_color_start) { .msg $chan ( $+ $nick $+ ): Error, Already the same, Please use an other color number! | return }
  19.     if ($2 > 15) { .msg $chan ( $+ $nick $+ ): Error, Too high parameter, Please specify only from 0-15 number! | return }
  20.     set %radio_color_start $2
  21.     .msg $chan ( $+ $nick $+ ): The Radio ShoutCast start color has been set.
  22.   }
  23.   if ($1 == !radiocolorend) {
  24.     if ($nick !isop $chan) { .msg $chan ( $+ $nick $+ ): You are NOT an channel moderator! | return }
  25.     if ($2 == $null) { .msg $chan ( $+ $nick $+ ): Error, Please specify a color number! | return }
  26.     if ($2 !isnum) { .msg $chan ( $+ $nick $+ ): Error, Please specify valid port! | return }
  27.     if ($2 == %radio_color_start) { .msg $chan ( $+ $nick $+ ): Error, Incorrect parameter, Please specify an other color this color has been set for start! | return }
  28.     if ($2 == %radio_color_end) { .msg $chan ( $+ $nick $+ ): Error, Already the same, Please use an other color number! | return }
  29.     if ($2 > 15) { .msg $chan ( $+ $nick $+ ): Error, Too high parameter, Please specify only from 0-15 number! | return }
  30.     set %radio_color_end $2
  31.     .msg $chan ( $+ $nick $+ ): The Radio ShoutCast end color has been set.
  32.   }
  33.   if ($1 == !radiohost) || ($1 == !radioip) {
  34.     if ($nick !isop $chan) { .msg $chan ( $+ $nick $+ ): You are NOT an channel moderator! | return }
  35.     if (!$2) { .msg $chan ( $+ $nick $+ ): Error, Please specify a host/ip! | return }
  36.     if (*:* iswm $2) { .msg $chan ( $+ $nick $+ ): Error, Please specify only an host/ip address without the port! | return }
  37.     if ($2 == %radio_ip) { .msg $chan ( $+ $nick $+ ): Error, Already the same, Please specify an other value! | return }
  38.     radio_stop
  39.     set %radio_ip $2
  40.     .msg $chan ( $+ $nick $+ ): The ShoutCast Radio host/ip has been set successfully.
  41.   }
  42.   if ($1 == !radioport) {
  43.     if ($nick !isop $chan) { .msg $chan ( $+ $nick $+ ): You are NOT an channel moderator! | return }
  44.     if (!$2) { .msg $chan ( $+ $nick $+ ): Error, Please specify an port! | return }
  45.     if ($2 !isnum) { .msg $chan ( $+ $nick $+ ): Error, Please specify valid port! | return }
  46.     if ($2 == %radio_port) { .msg $chan ( $+ $nick $+ ): Error, Already the same, Please specify an other value! | return }
  47.     radio_stop
  48.     set %radio_port $2
  49.     .msg $chan ( $+ $nick $+ ): The ShoutCast Radio port has been set successfully.
  50.   }
  51.   if ($1 == !radiostart) || ($1 == !radion) {
  52.     if ($nick !isop $chan) { .msg $chan ( $+ $nick $+ ): You are NOT an channel moderator! | return }
  53.     if (%radio) { .msg $chan ( $+ $nick $+ ): Error, Already running! | return }
  54.     set %radio 1
  55.     .msg $chan ( $+ $nick $+ ): The ShoutCast Radio auto announce has been started.
  56.     radio_start
  57.   }
  58.   if ($1 == !radiostop) || ($1 == !radioff) {
  59.     if ($nick !isop $chan) { .msg $chan ( $+ $nick $+ ): You are NOT an channel moderator! | return }
  60.     if (!%radio) { .msg $chan ( $+ $nick $+ ): Error, Not running! | return }
  61.     radio_stop
  62.     .msg $chan ( $+ $nick $+ ): The ShoutCast Radio auto announce has been stopped.
  63.   }
  64.   if ($1 == !lastsong) {
  65.     var %lsong = $hget(RADIO,LASTSONG)
  66.     if (!%lsong) { .msg $chan ( $+ $nick $+ ): There is NOT any last song yet played! | return }
  67.     .msg $chan ( $+ $nick $+ ):  $+ $cols $+ Last Played Song -  $+ $cole $+  $+ %lsong $+ 
  68.   }
  69.   if ($1 == !song) {
  70.     var %err = $get_radio
  71.     if (%err == 1) { radio_stop | .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio IP or Port are incorrect or not set! | return }
  72.     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 }
  73.     var %st = $hget(RADIO,STATUS)
  74.     if (!%st) { .msg $chan ( $+ $nick $+ ): The ShoutCast Radio is currently offline! | return }
  75.     var %song = $hget(RADIO,SONG)
  76.     .msg $chan ( $+ $nick $+ ):  $+ $cols $+ Now Playing -  $+ $cole $+  $+ $iif(%song,$v1,N/A) $+ 
  77.   }
  78.   if ($1 == !radiotopic) {
  79.     if (!$2) { .msg $chan ( $+ $nick $+ ): Error, Please specify a text! | return }
  80.     radio_topic $2-
  81.     .msg $chan ( $+ $nick $+ ): The topic has been successfully set.
  82.   }
  83.   if ($1 == !radiostatus) {
  84.     var %err = $get_radio
  85.     if (%err == 1) { radio_stop | .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio IP or Port are incorrect or not set! | return }
  86.     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 }
  87.     var %st = $hget(RADIO,STATUS)
  88.     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) $+ ) }
  89.     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) $+ ) }
  90.   }
  91.   if ($1 == !listeners) {
  92.     var %err = $get_radio
  93.     if (%err == 1) { radio_stop | .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio IP or Port are incorrect or not set! | return }
  94.     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 }
  95.     var %st = $hget(RADIO,STATUS)
  96.     if (!%st) { .msg $chan ( $+ $nick $+ ): The ShoutCast Radio is currently offline! | return }
  97.     var %max_l = $iif($hget(RADIO,MAXLISTENERS),$v1,0)
  98.     var %listeners = $iif($hget(RADIO,LISTENERS),$v1,0)
  99.     .msg $chan ( $+ $nick $+ ):  $+ $cols $+ Listener(s) -  $+ $cole $+  $+ %listeners $+  $+ $cols $+ / $+ $cole $+  $+ %max_l $+ 
  100.   }
  101.   if ($1 == !peak) {
  102.     var %err = $get_radio
  103.     if (%err == 1) { radio_stop | .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio IP or Port are incorrect or not set! | return }
  104.     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 }
  105.     var %peak = $hget(RADIO,PEAK)
  106.     if (!%peak) { .msg $chan ( $+ $nick $+ ): There is NOT any peak made yet! }
  107.     elseif (%peak) { .msg $chan ( $+ $nick $+ ):  $+ $cols $+ Peak Listener(s) -  $+ $cole $+  $+ %peak $+  }
  108.   }
  109.   if ($1 == !dj) {
  110.     var %err = $get_radio
  111.     if (%err == 1) { radio_stop | .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio IP or Port are incorrect or not set! | return }
  112.     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 }
  113.     var %st = $hget(RADIO,STATUS)
  114.     if (!%st) { .msg $chan ( $+ $nick $+ ): The ShoutCast Radio is currently offline! | return }
  115.     var %dj = $hget(RADIO,DJ)
  116.     if (!%dj) { .msg $chan ( $+ $nick $+ ): There is NOT any DJ yet on the descs! }
  117.     elseif (%dj) { .msg $chan ( $+ $nick $+ ):  $+ $cols $+ Currently DJ -  $+ $cole $+  $+ %dj $+  }
  118.   }
  119.   if ($1 == !genre) {
  120.     var %err = $get_radio
  121.     if (%err == 1) { radio_stop | .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio IP or Port are incorrect or not set! | return }
  122.     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 }
  123.     var %st = $hget(RADIO,STATUS)
  124.     if (!%st) { .msg $chan ( $+ $nick $+ ): The ShoutCast Radio is currently offline! | return }
  125.     var %genre = $hget(RADIO,GENRE)
  126.     if (!%genre) { .msg $chan ( $+ $nick $+ ): There is NOT any GENRE yet has been set on the radio! }
  127.     elseif (%genre) { .msg $chan ( $+ $nick $+ ):  $+ $cols $+ Currently Genre -  $+ $cole $+  $+ %genre $+  }
  128.   }
  129.   if ($1 == !radiouptime) {
  130.     var %err = $get_radio
  131.     if (%err == 1) { radio_stop | .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio IP or Port are incorrect or not set! | return }
  132.     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 }
  133.     var %st = $hget(RADIO,STATUS)
  134.     if (!%st) { .msg $chan ( $+ $nick $+ ): The ShoutCast Radio is currently offline! | return }
  135.     var %uptime = $hget(RADIO,UPTIME)
  136.     if (!%uptime) { .msg $chan ( $+ $nick $+ ): The ShoutCast Radio is NOT online! }
  137.     elseif (%uptime) { .msg $chan ( $+ $nick $+ ):  $+ $cols $+ The ShoutCast Radio uptime is:  $+ $cole $+  $+ $duration(%uptime) $+  }
  138.   }
  139.   if ($1 == !bitrate) || ($1 == !bits) || ($1 == !bitrates) {
  140.     var %err = $get_radio
  141.     if (%err == 1) { radio_stop | .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio IP or Port are incorrect or not set! | return }
  142.     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 }
  143.     var %st = $hget(RADIO,STATUS)
  144.     if (!%st) { .msg $chan ( $+ $nick $+ ): The ShoutCast Radio is currently offline! | return }
  145.     var %bits = $hget(RADIO,BITRATE)
  146.     if (!%bits) { .msg $chan ( $+ $nick $+ ): The ShoutCast Radio is NOT online! }
  147.     elseif (%bits) { .msg $chan ( $+ $nick $+ ):  $+ $cols $+ Radio Bitrate -  $+ $cole $+  $+ %bits $+ kbps $+  }
  148.   }
  149.   if ($1 == !listen) || ($1 == !tune) {
  150.     if (!%radio_ip) { .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio does not has an IP/Host set! | return }
  151.     if (!%radio_port) { .msg $chan ( $+ $Nick $+ ): Error, The ShoutCast Radio does NOT has an Port set! | return }
  152.     .msg $chan ( $+ $nick $+ ):  $+ $cols $+ Listen us now from -  $+ $cole $+  $+ http:// $+ %radio_ip $+ : $+ %radio_port $+ /listen.pls $+ 
  153.   }
  154.   if ($1 == !info) || ($1 == !np) || ($1 == !stats) {
  155.     var %err = $get_radio
  156.     if (%err == 1) { radio_stop | .msg $chan ( $+ $nick $+ ): Error, The ShoutCast Radio IP or Port are incorrect or not set! | return }
  157.     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 }
  158.     var %st = $hget(RADIO,STATUS)
  159.     if (!%st) { .msg $chan ( $+ $nick $+ ): The ShoutCast Radio is currently offline! | return }
  160.     var %dj = $iif($hget(RADIO,DJ),$v1,N/A)
  161.     var %song = $iif($hget(RADIO,SONG),$v1,N/A)
  162.     var %bits = $iif($hget(RADIO,BITRATE),$v1,0)
  163.     var %max_l = $iif($hget(RADIO,MAXLISTENERS),$v1,0)
  164.     var %listeners = $iif($hget(RADIO,LISTENERS),$v1,0)
  165.     var %genre = $iif($hget(RADIO,GENRE),$v1,N/A)
  166.     var %uptime = $iif($hget(RADIO,UPTIME),$duration($v1),N/A)
  167.     .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 $+ 
  168.   }
  169.   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 }
  170. }
  171.  
  172. alias radio_topic { ; by westor 15/062015
  173.   if (!$1-) { return }
  174.   var %chan = #chaotic-radio
  175.   var %t = $scon(0)
  176.   var %i = 1
  177.   while (%i <= %t) {
  178.     var %s = $scon(%i).cid
  179.     if ($scid(%s).status == connected) {
  180.       var %chans = $mchans(%s)
  181.       var %old = $mtopic(%s,%chan)
  182.       var %new = $strip($1-)
  183.       if (%chans) && ($istok(%chans,%chan,44)) {
  184.         if (%old !== %new) { scid %s .topic %chan $1- }
  185.       }
  186.     }
  187.     inc %i
  188.   }
  189. }
  190.  
  191. alias radio_msg { ; by westor 15/062015
  192.   if (!$1-) { return }
  193.   var %chan = #chaotic-radio
  194.   var %t = $scon(0)
  195.   var %i = 1
  196.   while (%i <= %t) {
  197.     var %s = $scon(%i).cid
  198.     if ($scid(%s).status == connected) {
  199.       var %chans = $mchans(%s)
  200.       if (%chans) && ($istok(%chans,%chan,44)) { scid %s .msg %chan $1- }
  201.     }
  202.     inc %i
  203.   }
  204. }
  205.  
  206. alias mchans { ; by westor 15/062015
  207.   if (!$1) { return }
  208.   scid $1
  209.   var %t = $chan(0)
  210.   var %i = 1
  211.   while (%i <= %t) {
  212.     var %c = $chan(%i)
  213.     if ($me isop %c) { var %tot = $addtok(%tot,%c,44) }
  214.     inc %i
  215.   }
  216.   if (%tot) { return %tot }
  217.   elseif (!%tot) { return 0 }
  218. }
  219.  
  220. alias mtopic { ; by westor 15/062015
  221.   if (!$1) && (!$2) { return }
  222.   scid $1
  223.   if ($me isop $2) { var %top = $strip($chan($2).topic) }
  224.   if (%top) { return %top }
  225.   elseif (!%top) { return 0 }
  226. }
  227.  
  228. alias radio_say { ; by westor 15/062015
  229.   if ($status !== connected) { return }
  230.   var %old = $hget(RADIO,SONG)
  231.   var %err = $get_radio
  232.   if (%err == 1) {
  233.     radio_stop
  234.     radio_msg Error, The ShoutCast Radio IP or Port are incorrect or not set, the auto announce has been stopped!
  235.     return
  236.   }
  237.   if (%err == 2) {
  238.     radio_stop
  239.     radio_msg Error, The ShoutCast Radio IP or Port are incorrect, or an connection problem has been occurred, the auto announce has been stopped!
  240.     return
  241.   }
  242.   var %st = $hget(RADIO,STATUS)
  243.   if (!%st) {
  244.     if ($hget(RADIO,STOP)) { return }
  245.     hadd -m RADIO STOP 1
  246.     if ($hget(RADIO,TOPIC)) { hdel RADIO TOPIC }
  247.     radio_msg The ShoutCast Radio is currently offline!
  248.     radio_topic  $+ $cole $+ ,1[ $+ $cols $+ Chaotic-Radio is  $+ $cole $+ Offline $+ $cols :( $+ $cole $+ ]
  249.     return
  250.   }
  251.   if ($hget(RADIO,STOP)) { hdel RADIO STOP }
  252.   var %new = $hget(RADIO,SONG)
  253.   var %dj = $iif($hget(RADIO,DJ),$v1,N/A)
  254.   var %song = $iif($hget(RADIO,SONG),$v1,N/A)
  255.   var %bits = $iif($hget(RADIO,BITRATE),$v1,0)
  256.   var %max_l = $iif($hget(RADIO,MAXLISTENERS),$v1,0)
  257.   var %listeners = $iif($hget(RADIO,LISTENERS),$v1,0)
  258.   var %genre = $iif($hget(RADIO,GENRE),$v1,N/A)
  259.   var %uptime = $iif($hget(RADIO,UPTIME),$duration($v1),N/A)
  260.   if (!$hget(RADIO,TOPIC)) { hadd -m RADIO TOPIC 1 | radio_topic  $+ $cole $+ ,1[ $+ $cols $+ Chaotic-Radio is  $+ $cole $+ Online $+ $cols :) $+ $cole $+ ] }
  261.   if (%old) && (%old !== %new) { hadd -m RADIO LASTSONG %old }
  262.   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 $+  }
  263. }
  264.  
  265. alias radio_stop { ; by westor 15/062015
  266.   unset %radio
  267.   .timer[RADIO_AUTO] off
  268.   if ($hget(RADIO)) { hfree $v1 }
  269. }
  270.  
  271. alias radio_start { ; by westor 15/062015
  272.   if ($status !== connected) { return }
  273.   if (!%radio) { return }
  274.   if ($hget(RADIO)) { hfree $v1 }
  275.   .timer[RADIO_AUTO] 0 10 radio_say
  276. }
  277.  
  278. alias get_radio { ; by westor 15/062015
  279.   if ($status !== connected) { return }
  280.   if (!%radio_ip) && (!%radio_port) {
  281.     if ($isid) { return 1 }
  282.     return
  283.   }
  284.   var %v = radio_ $+ $ticks $+ $ctime
  285.   var %u = http:// $+ %radio_ip $+ : $+ %radio_port $+ /statistics?json=1&nocache= $+ $ticks
  286.   JSONOpen -du %v %u
  287.   if ($JSONError) {
  288.     if ($isid) { return 2 }
  289.     return
  290.   }
  291.   hadd -m RADIO STATUS $json(%v,streams,0,streamstatus)
  292.   hadd -m RADIO PEAK $json(%v,streams,0,peaklisteners)
  293.   hadd -m RADIO SONG $json(%v,streams,0,songtitle)
  294.   hadd -m RADIO DJ $json(%v,streams,0,dj)
  295.   hadd -m RADIO GENRE $json(%v,streams,0,servergenre)
  296.   hadd -m RADIO UPTIME $json(%v,streams,0,streamuptime)
  297.   hadd -m RADIO BITRATE $json(%v,streams,0,bitrate)
  298.   hadd -m RADIO LISTENERS $json(%v,streams,0,currentlisteners)
  299.   hadd -m RADIO MAXLISTENERS $json(%v,streams,0,maxlisteners)
  300. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement