#-> mIRC Socket Bot by KnickLighter #-> Named as 'sBot.mIRC' #-> Configuration: #-> Server/DNS to connect to: alias sbot.server return { irc.chattersweb.nl } #-> Port to connect to: alias sbot.port return { 6667 } #-> Server password (leave blank if not used): alias sbot.serverpass return { } #-> Bot's nickname alias sbot.nick return { sBot } #-> NickServ password alias sbot.nspass return { } #-> Channel to join: alias sbot.channel return { #root } #-> Channel password (leave blank if not used): alias sbot.chankey return { } #-> On-Join message to send: alias sbot.onjoinmsg return { [sBot.mIRC]: A mIRC SocketBot by KnickLighter } #-> An alias for debugging alias sbot.db { window -e @sBot echo @sBot $time([HH:nn:ss]) $+(-sBot:,$1,-) $2- } #-> Sockwrite raw alias alias sraw { sockwrite -nt sBot $1- } #-> Sockwrite PRIVMSG alias alias smsg { sockwrite -nt sBot PRIVMSG $1 : $+ $2- } #-> The '/sbot' alias to start/stop the bot: alias sBot { ;-> Start command if ($1 == start) { ;-> Check if the socket is already in use if ($sock(sBot) != $null) { sbot.db error Cannot create socket: Already in use. halt } ;-> The script will end up here when the socket isn't in use ;-> So let's create the socket sockopen sBot $sbot.server $sbot.port sbot.db msg Bot started. The socket has been opened... ;-> When the socket has been opened, we go further processing this at the 'SOCKOPEN' event halt } ;-> Stop command if ($1 == stop) { ;-> First we check if the socket is open, if so; close it, if not; tell us if ($sock(sBot) != $null) { sockclose sBot sbot.db msg Bot stopped. The socket has been closed... halt } ;-> Tell us the bot isn't running else { sbot.db error Bot isn't running. halt } } ;-> What to do when none of the above commands are entered or the input is blank else { sbot.db error Syntax: /sBot halt } } #-> The sockopen event on *:sockopen:sBot:{ ;-> Check wether it connects or not if ($sockerr > 0) { ;-> Close the socket and send error sockclose $sockname sbot.db error Could not connect to the server, aborting and closing socket... halt } ;-> Send commands to IRC server sbot.db msg Connected, sending authentication commands... sraw NICK $sbot.nick sraw USER sBot x x :sBot by KnickLighter sraw NICKSERV identify $sbot.nspass sraw JOIN $sbot.channel $sbot.chankey if ($sbot.onjoinmsg != $null) { smsg $sbot.channel $sbot.onjoinmsg } halt }