Jump to content

Archived

This topic is now archived and is closed to further replies.

chain

mIRC SHOUTcast Bot v1.0

Recommended Posts

  • Administrators

mIRC SHOUTcast Bot v1.0

 

logo.jpg

 

An mIRC script to help manage your SHOUTcast stream

In a nutshell

This script allows for a simple SHOUTcast stream management bot to reside in your channel, while announcing current playing songs. I've been adding little improvements here and there, and I'm willing to take suggestions for features.

 

Configure:

Set the variables above "Connect & Identify" to your liking, then restart the mIRC client and the bot will just work.

 

It includes:

* Auto announce (for songs on the shoutcast stream)

* Manage topic (changes topic when DJ changes)

* Auto connect / identify (Anope; nickserv)

 

 

Commands (that require the user to have @op to use):

!kickdj - kicks active dj

!info - notices user stream information (eg: url, port, dj pass, etc)

!cycle - bot does a /hop

 

 

Commands (anyone can use):

!dj - notices user current DJ

!song - notices user current song

!tune/!url/!listen - notices user the link to the stream

!listeners - notices the user with current listener amount

!stats - notices user a quick summary of stream info (dj, genre, bitrate, listeners, etc)

 

; This code is released under the public domain.

 

;:::::::::::::::::::::

;:  Load variables  ::

;:::::::::::::::::::::

 

on *:start: {

 

  ;; site url

  set %cfg.site http://google.com/

  ;; stream base url without http:// or trailing slash

  set %cfg.stream listen.google.com

  ;; radio name

  set %cfg.name Google Radio!

  ;; radio port (usually 8000)

  set %cfg.port 8000

  ;; admin username (usually admin)

  set %cfg.user admin

  ;; admin password

  set %cfg.pass OMGepic9455w0rd!

  ;; dj password

  set %cfg.djpass IMaDJnowMOM!

  

  

  ;; bots nick

  set %bot.nick GRBot

  ;; bots alt nick

  set %bot.anick GRBot1

  ;; bots username

  set %bot.user Google

  ;; bots realname

  set %bot.name Tay Zonday

  

 

  ;; irc server

  set %irc.server irc.google.com

  ;; irc port (prepend + for SSL servers)

  set %irc.port +7000

  ;; irc channel

  set %irc.chan #radio

  ;; NickServ password

  set %irc.pass NickServPassWordLOL1!

  

 

  ;; connection command (you shouldn't HAVE to modify this)

  server %irc.server %irc.port -i %bot.nick %bot.anick %bot.user %bot.name

}

 

;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

;: %sc.status (0 for offline, 1 for online) | %sc.genre (genre)                         ::

;: %sc.clisten (current listeners)          | %sc.bitrate (bitrate)                     ::

;: %sc.rlisten (unique listeners)           | %sc.dj (current DJ, pulled from AIM tag)  ::

;: %sc.plisten (peak listeners)             | %sc.song (current song)                   ::

;: %sc.mlisten (max listeners)              | %cfg.site (website url)                   ::

;: %sc.alisten (average listen time)        |                                           ::

;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

 

;; Channel topic (bot needs @op to change)

alias chan.topic { return 07,01 $+ %cfg.name $+ 15,01 Do you want fries with that? 14,01 $+ $chr(124) 07,01Current DJ14,01:15,01 $iif(%sc.status == 1, %sc.dj, None) 14,01 $+ $chr(124) 07,01Tune14,01:15,01 %cfg.site }

 

;; Message format

alias sc.msg { msg %irc.chan %sc.dj is streaming %sc.song ( $+ %sc.bitrate $+ kbps) }

 

;:::::::::::::::::::::::::

;:  Connect & Identify  ::

;:::::::::::::::::::::::::

 

on *:notice:*This nickname is registered and protected.*:*: { .msg NickServ IDENTIFY %irc.pass }

 

on *:notice:*Password accepted - you are now recognized.*:*: { .join %irc.chan }

 

on *:disconnect: { timers off }

 

on *:join:%irc.chan: { $iif($nick == $me, .timercon 0 10 sc.con) }

 

on *:kick:%irc.chan: { $iif($knick == $me, timers off) }

 

on *:part:%irc.chan: { $iif($nick == $me, timers off) }

 

;::::::::::::::::::::::

;:  Socket commands  ::

;::::::::::::::::::::::

 

alias sc.con {

  if ($sock(sc).to == $null) { sockopen sc %cfg.stream %cfg.port  }

  elseif ($sock(sc).to > 8) { sockclose sc | sockopen sc %cfg.stream %cfg.port }

}

 

alias sc.kick { sockopen sckick %cfg.stream %cfg.port }

 

alias sc.title { topic %irc.chan $chan.topic }

 

;::::::::::::::::::::::::

;:  Function commands  ::

;::::::::::::::::::::::::

 

alias errmsg {

  if ($1 == op) { notice $2 You must have @ (operator) status to use this. }

  elseif ($1 == offline) { notice $2 The stream is currently offline. }

}

 

;::::::::::::::::::::::::

;:  Trigger functions  ::

;::::::::::::::::::::::::

 

on *:text:!cycle:%irc.chan: {

  if ($nick isop %irc.chan) { hop %irc.chan }

  else { errmsg op $nick }

}

 

on *:text:!info:%irc.chan: {

  if ($nick isop %irc.chan) {

    notice $nick host: %cfg.stream port: %cfg.port pass: %cfg.djpass

    notice $nick description: %cfg.name url: %cfg.site aim: your DJ name irc: %irc.chan

  }

  else { errmsg op $nick }

}

 

on *:text:!kickdj:%irc.chan: {

  if ($nick isop %irc.chan) { sc.kick | msg %irc.chan Kicking current DJ.. }

  else { errmsg op $nick }

}

 

on *:text:!dj:%irc.chan: {

  if (%sc.status == 1) { notice $nick Current DJ: %sc.dj }

  else { notice $nick Nobody is currently DJing. }

}

 

on *:text:!song:%irc.chan: {

  if (%sc.status == 1) { notice $nick Playing: %sc.song }

  else { notice $nick Nobody is currently DJing. }

}

 

on *:text:!stats:%irc.chan: {

  if (%sc.status == 1) {

    notice $nick General: dj= $+ %sc.dj $+ $chr(59) genre= $+ %sc.genre $+ $chr(59) bitrate= $+ %sc.bitrate $+ kbps $+ $chr(59)

    notice $nick Listeners: cur= $+ %sc.clisten $+ $chr(59) peak= $+ %sc.plisten $+ $chr(59) max= $+ %sc.mlisten $+ $chr(59) avgtime= $+ %sc.alisten $+ $chr(59)

  }

  else { notice $nick Stream: is currently offline }

}

 

on *:text:!tune:%irc.chan: { notice $nick Tune in at: http:// $+ %cfg.stream $+ : $+ %cfg.port $+ /listen.pls }

on *:text:!url:%irc.chan: { notice $nick Tune in at: http:// $+ %cfg.stream $+ : $+ %cfg.port $+ /listen.pls }

on *:text:!listen:%irc.chan: { notice $nick Tune in at: http:// $+ %cfg.stream $+ : $+ %cfg.port $+ /listen.pls }

 

on *:text:!listeners:%irc.chan: {

  if (%sc.status == 1) { notice $nick Listeners: %sc.clisten $+ / $+ %sc.mlisten ( $+ %sc.dj $+ ) }

  else { errmsg offline $nick }

}

 

;:::::::::::::::::::::::

;:  Socket functions  ::

;:::::::::::::::::::::::

 

on *:sockopen:sckick: {

  sockwrite -nt sckick GET /admin.cgi?mode=kicksrc HTTP/1.0

  sockwrite -nt sckick User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.642.2 Safari/534.16

  sockwrite -nt sckick Accept: text/xml,application/xml,application/xhtml+xml,text/html

  sockwrite -nt sckick Authorization: Basic $encode(%cfg.user $+ : $+ %cfg.pass, m)

  sockwrite -nt sckick $crlf

}

 

on *:sockread:sckick: {

  sockread -fn %tmp

  if (HTTP/1.0 302 Found isin %tmp) { msg %irc.chan DJ kicked. Go go go! }

}

 

on *:sockopen:sc: {

  sockwrite -nt sc GET /admin.cgi?mode=viewxml HTTP/1.0

  sockwrite -nt sc User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.642.2 Safari/534.16

  sockwrite -nt sc Accept: text/xml,application/xml,application/xhtml+xml,text/html

  sockwrite -nt sc Authorization: Basic $encode(%cfg.user $+ : $+ %cfg.pass, m)

  sockwrite -nt sc $crlf

}

 

on *:sockread:sc: {

  sockread -fn %tmp

 

 

  ;; Pulls the buffer of XML you need.

  if (

Link to comment
Share on other sites



×
×
  • Create New...