This is a very simple socket bot, which shows how simple it is to create a connection to an IRC server via mIRC sockets. Stability of this version is unknown, there are connection problems on some networks with ping timeout issues but most of these have been resolved in version 2. The second version of this bot is currently in scripting and contains actual user commands aswell as a debug window so you will be able to see everything that the bot is seeing, it will be released in the next month or so :P If you have any suggestions for version 2 put them in the comments section. * For further help join #Advanced on IRC.AustNet.Org (paagrio.at.eu.austnet.org or sg.austnet.org)
alias SocketBot {
sockopen bot <Server Address> <Port>
}
on *:sockopen:bot: {
sockwrite -tn $sockname nick <Bot Name>
sockwrite -tn $sockname user <Bot Name> <Bot Name> advanced.cia :<Bot Name> @ Advanced Socket Bot.
}
on *:sockread:bot: {
echo -s SocketBot - %temp
sockread -f %temp
if ($sockerr > 0) { echo *** ERROR $+([,$sock($sockname).wsmsg,].) | halt }
if ($gettok(%temp,1,32) == PING) { sockwrite -tn $sockname PONG $gettok(%temp,2,32) }
if ($1 == PING && $2) { sockwrite -tn $sockname PONG $2- }
else { return }
sockbotread %temp
sockbotserver %temp
}
alias botsend sockwrite -tn bot
alias botread return $remove($1,:)
alias sockbotread {
if ($botread($4) == VERSION) { botsend $socknick($1) :VERSION SocketBot Version 1.2 (Build #2004101) by Prophetor }
if ($botread($4) == FINGER) { botsend $socknick($1) :FINGER SocketBot Version 1.2 (Build #2004101) by Prophetor}
if (PING isin $botread($4)) { botsend $socknick($1) :PING SocketBot Version 1.2 (Build #2004101) by Prophetor }
if ($botread($4) == TIME) { botsend $socknick($1) :TIME $time(hh:nn:sstt) $+ }
}
alias bot.join { sockwrite -tn bot JOIN #$$1 }
alias bot.part { sockwrite -tn bot PART #$$1 }
alias bot.kill { sockclose bot }
how is it possible that this thing even works? o_o
alias botsend sockwrite -tn bot
should be
alias botsend sockwrite -tn bot $1-
alias bot.join { sockwrite -tn bot JOIN #$$1 }
alias bot.part { sockwrite -tn bot PART #$$1 }
should be
alias bot.join { sockwrite -tn bot JOIN $+(#,$1) }
alias bot.part { sockwrite -tn bot PART $+(#,$1) }