All pastes #749247 Raw Edit

Something

public text v1 · immutable
#749247 ·published 2007-10-25 15:30 UTC
rendered paste body
#-> 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     { }

#-> Bot's nickname
alias sbot.nick           { sBot }

#-> NickServ password
alias sbot.nspass         { }

#-> Channel to join:
alias sbot.channel        { #root }

#-> Channel password (leave blank if not used):
alias sbot.channelpass    { }

#-> On-Join message to send:
alias sbot.onjoinmsg      { [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-
}


#-> 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 <start/stop>
    halt
  }
}