[Help] No idea why my script is not working
Ok so here's the deal.
In the IRC channel I'm in I'm running an online radio for the community and wanted to run an IRC bot on my dedicated server.
This bot should:
- Alter the topic
- Announce what songs are played
- Provide links to the playlist
And here is my problem.
If I run this bot on my own pc it works like a charm, but I want it to be in the channel 24/7 so I installed mIRC on my dedi and simply copy/pasted the bot script onto my dedi.
And what do u think happens? The bot doesn't seem to work at all on my dedi.
Not getting any errors either.
I'm clueless o_O
Script:
Code:
; This code is released under the public domain.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; CONFIGURATION ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;
alias sc_cfg {
; website URL
set %stream.site http://free.freeshoutcast.com:54866
; stream url (without http:// or trailing slash)
set %stream.url free.freeshoutcast.com
; radio stations name
set %stream.name aRev Radio
; port that the server runs on
set %stream.port 54866
; admin username (usually admin)
set %stream.user xxxxxx
; admin password
set %stream.adpass xxxxxxx
; dj password
set %stream.djpass xxxxxxx
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; manage topic (1 is on, 0 is off)
set %cfg.top 1
; announce new song (1 is on, 0 is off)
set %cfg.ann 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; bots nick
set %irc.nick aRev|Radio
; bots alt nick
set %irc.anick aRev|Radio
; bots username
set %irc.user aRev|Radio
; bots realname
set %irc.name aRev|Radio
; irc server
set %irc.server irc.rizon.net
; irc port (prepend + for SSL servers)
set %irc.port 6668
; irc channel
set %irc.chan #alterRevolution
; NickServ password
set %irc.pass xxxxxxxx
}
; channel topic format
alias sc.topic { return Official IRC Chat of alterRevolution - http://alterrev.net - SUBSCRIBE http://www.youtube.com/user/alterRevolutionTeam - %stream.name $chr(124) Current DJ: $iif(%sc.status == 1,%sc.dj,None) $chr(124) %stream.site }
; song announce format
alias sc.ann { return (*** %sc.dj is playing %sc.song ***) (*** type !tune to tune in! ***) }
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; ON FUNCTIONS ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;
on *:start: {
; set variables
sc_cfg
; connect to server
server %irc.server %irc.port -i %irc.nick %irc.anick %irc.user %irc.name
}
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 *:join:%irc.chan: { $iif($nick == $me, .timercon 0 10 sc_con) }
on *:disconnect: { .timers off }
on *:kick:%irc.chan: { $iif($knick == $me, timers off) }
on *:part:%irc.chan: { $iif($nick == $me, timers off) }
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; SC COMMANDS ;;
;; ;;
;;;;;;;;;;;;;;;;;;;
; connect to shoutcast server
alias sc_con {
if ($sock(sc).to == $null) { sockopen sc %stream.url %stream.port }
elseif ($sock(sc).to > 8) { sockclose sc | sockopen sc %stream.url %stream.port }
}
; kick dj
alias sc_kick { sockopen sckick %stream.url %stream.port }
; topic change
alias sc_topic { if (%cfg.top == 1) { topic %irc.chan $sc.topic } }
; song announce
alias sc_msg { if (%cfg.ann == 1) { msg %irc.chan $sc.ann } }
; send error message to user
alias sc_errmsg {
if ($1 == op) { msg $2 You must have @ (operator) status to use this. }
if ($1 == offline) { msg $2 The stream is currently offline. }
}
; filters characters back from html ascii codes
alias sc_filter { return $replace($1-, & $+ $chr(59), $chr(38), ' $+ $chr(59), $chr(39)) }
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; @OP TRIGGERS ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;
; !cycle: bot /cycles in channel
on *:text:!cycle:%irc.chan: {
if ($nick isop %irc.chan) { hop %irc.chan }
else { sc_errmsg op $nick }
}
; !info: sends the required dj information
on *:text:!info:%irc.chan: {
if ($nick isop %irc.chan) {
msg $nick host: %stream.url port: %stream.port pass: %stream.djpass
msg $nick description: %stream.name url: %stream.site aim: Use your DJ name irc: %irc.chan
}
else { sc_errmsg op $nick }
}
; !kickdj: kicks current dj
on *:text:!kickdj:%irc.chan: {
if ($nick isop %irc.chan) { sc_kick | msg %irc.chan Kicking current DJ.. }
else { sc_errmsg op $nick }
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; USER TRIGGERS ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;
; !dj: sends active dj
on *:text:!dj:%irc.chan: {
if (%sc.status == 1) { msg $chan Current DJ: %sc.dj }
else { sc_errmsg offline $nick }
}
; !song: sends the current song
on *:text:!song:%irc.chan: {
if (%sc.status == 1) { msg $chan Playing: %sc.song }
else { sc_errmsg offline $nick }
}
on *:text:!tune:%irc.chan: { msg $chan Tune in at: http:// $+ %stream.url $+ : $+ %stream.port $+ /listen.pls }
on *:text:!url:%irc.chan: { msg $chan Tune in at: http:// $+ %stream.url $+ : $+ %stream.port $+ /listen.pls }
on *:text:!listen:%irc.chan: { msg $chan Tune in at: http:// $+ %stream.url $+ : $+ %stream.port $+ /listen.pls }
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; KICK SOCKETS ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;
on *:sockopen:sckick: {
sockwrite -nt sckick GET /admin.cgi?mode=kicksrc HTTP/1.0
sockwrite -nt sckick User-Agent: Mozilla/5.0
sockwrite -nt sckick Accept: text/xml,application/xml,application/xhtml+xml,text/html
sockwrite -nt sckick Authorization: Basic $encode(%stream.user $+ : $+ %stream.adpass, m)
sockwrite -nt sckick $crlf
}
on *:sockread:sckick: {
sockread -fn %tmp
if (HTTP/1.0 302 Found isin %tmp) { msg %irc.chan ..DJ was successfully kicked. }
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; XML SOCKETS ;;
;; ;;
;;;;;;;;;;;;;;;;;;;
on *:sockopen:sc: {
sockwrite -nt sc GET /admin.cgi?mode=viewxml HTTP/1.0
sockwrite -nt sc User-Agent: Mozilla/5.0
sockwrite -nt sc Accept: text/xml,application/xml,application/xhtml+xml,text/html
sockwrite -nt sc Authorization: Basic $encode(%stream.user $+ : $+ %stream.adpass, m)
sockwrite -nt sc $crlf
}
on *:sockread:sc: {
sockread -fn %xml
; assign variable in proper order, halt reading, scan info, relay, garbage collection!
if (<?xml isin %xml) { set %a $mid(%xml,2033,$len(%xml)) }
elseif (> isin %xml) { set %a %a $+ %xml }
if (</SHOUTCASTSERVER> isin %a) {
HALTDEF
unset %xml
; dj
var %z $sc_filter($left($gettok($replace(%a, <AIM>, $chr(189), </AIM>, $chr(189)),2,189),$len($gettok($replace(%a, <AIM>, $chr(189), </AIM>, $chr(189)),2,189))))
if (%z != %sc.dj) && (%sc.dj) { set %sc.dj %z | sc_topic }
else { set %sc.dj %z }
; status
var %z $gettok($replace(%a, <STREAMSTATUS>, $chr(189), </STREAMSTATUS>, $chr(189)),2,189)
if (%z != %sc.status) && (%sc.status) { set %sc.status %z | sc_topic }
else { set %sc.status %z }
; current listeners
var %z $gettok($replace(%a, <CURRENTLISTENERS>, $chr(189), </CURRENTLISTENERS>, $chr(189)),2,189)
set %sc.clisten %z
; peak listeners
var %z $gettok($replace(%a, <PEAKLISTENERS>, $chr(189), </PEAKLISTENERS>, $chr(189)),2,189)
set %sc.plisten %z
; max listeners
var %z $gettok($replace(%a, <MAXLISTENERS>, $chr(189), </MAXLISTENERS>, $chr(189)),2,189)
set %sc.mlisten %z
; genre
var %z $gettok($replace(%a, <SERVERGENRE>, $chr(189), </SERVERGENRE>, $chr(189)),2,189)
set %sc.genre %z
; song title
var %z $sc_filter($left($gettok($replace(%a, <SONGTITLE>, $chr(189), </SONGTITLE>, $chr(189)),2,189),$len($gettok($replace(%a, <SONGTITLE>, $chr(189), </SONGTITLE>, $chr(189)),2,189))))
if (%z != %sc.song) { set %sc.song %z | sc_msg }
unset %a
}
}