Ok I coded this recently it works for what it does 100% but not everythings coded in. Its designed so you can be out and about and connect to your computers mirc and see what your bot see's, kind of like a IRC bouncer. I was going to make a control channel etc but I dont have the time at the moment.
Its really just a concept idea at the moment. I will be coding a full server out of mIRC soon when I get the time just for the sake of it.
To use:
Load onto your bot and type /open
this will then allow connections to your computer on port 6667.
For testing:
on another mirc type /server -m localhost
and then /auth user pass (Litrally like that, dont try to change them to a real user and pass)
It will then act like a real IRC server but will actually be your bot.
For out and about:
Get your ip by googling whats my ip.
then /server -m IPADDRESS then /auth user pass
alias open {
socklisten irc999 6667
;listen on port 6667 for IRC
;Add other ports using the following format:
; socklisten irc99<Number> <PORT>
}
alias sockwrite {
echo -a <- $2-
sockwrite $1-
}
on *:socklisten:irc99*:{
;Assign a tempary name to the socket
var %tmp guest $+ $r(1,1000)
sockaccept %tmp
}
on *:PART:#:{
var %i 1
while (%i <= $lines(users.txt)) {
sockwrite -n $read(users.txt,%i) : $+ $address($nick,5) PART $chan $1-
inc %i
}
}
on *:JOIN:#:{
var %i 1
while (%i <= $lines(users.txt)) {
sockwrite -n $read(users.txt,%i) : $+ $address($nick,5) JOIN $chan
inc %i
}
}
on *:RAWMODE:#:{
var %i 1
while (%i <= $lines(users.txt)) {
sockwrite -n $read(users.txt,%i) : $+ $address($nick,5) MODE $chan $1-
inc %i
}
}
on *:TEXT:*:#:{
var %i 1
while (%i <= $lines(users.txt)) {
sockwrite -n $read(users.txt,%i) : $+ $address($nick,5) PRIVMSG $chan : $+ $1-
inc %i
}
}
on *:ACTION:*:#:{
var %i 1
while (%i <= $lines(users.txt)) {
sockwrite -n $read(users.txt,%i) : $+ $address($nick,5) PRIVMSG $chan :ACTION $1-
inc %i
}
}
on *:SOCKREAD:*:{
var $+(%,irc.,$sockname)
sockread $+(%,irc.,$sockname)
tokenize 32 $($+(%,irc.,$sockname),2)
echo -a <- $1-
if ($1 == NICK) {
sockrename $sockname $2
write users.txt $2
var %i 1
while (%i <= $lines(users.txt)) {
sockwrite -n $read(users.txt,%i) NOTICE AUTH :3-> USER $2 has connected.
inc %i
}
}
elseif ($1 == JOIN) {
var %i 1
while (%i <= $lines(users.txt)) {
sockwrite -n $read(users.txt,%i) : $+ $read(users.txt,%i) $+ ! $+ $me $+ @plorntirc.com JOIN : $+ $2
inc %i
}
join $2
}
elseif ($1 == USER) {
;USER nnscript "" "localhost" :Tom
writeini users.ini $sockname idnt $2
writeini users.ini $sockname 2 $iif($remove($3,$chr(34)),$v1,unknown)
writeini users.ini $sockname host $remove($4,$chr(34))
writeini users.ini $sockname realname $remove($5,$chr(58))
sockwrite -n $sockname NOTICE AUTH :4,1!!!9Please Auth yourself before going any further.4!!!
}
elseif ($1 == ping) {
sockwrite -n $sockname PONG $2
}
elseif ($1 == PRIVMSG) {
raw $1-
}
elseif ($1 == QUIT) {
write -ds $+ $sockname users.txt
var %i 1
while (%i <= $lines(users.txt)) {
sockwrite -n $read(users.txt,%i) NOTICE AUTH :4,1User $sockname has disconnected
inc %i
}
}
elseif ($1 == AUTH) {
if ($2 == user && $3 == pass) {
sockwrite -n $sockname 001 $sockname :Welcome to the $me IRC Network $sockname $+ ! $+ $sockname $+ @ $+ $readini(users.ini,$sockname,host)
sockwrite -n $sockname 002 $sockname :Your host is $remove($4,$chr(34)) $+ , running version PlorntIRCv1
sockwrite -n $sockname 004 $sockname $readini(users.ini,$sockname,host) Unreal3.2.7 iowghraAsORTVSxNCWqBzvdHtGp lvhopsmntikrRcaqOALQbSeIKVfMCuzNTGj
sockwrite -n $sockname 005 $sockname CMDS=KNOCK,MAP,DCCALLOW,USERIP NAMESX SAFELIST HCN MAXCHANNELS=35 CHANLIMIT=#:35 MAXLIST=b:60,e:60,I:60 NICKLEN=30 CHANNELLEN=32 TOPICLEN=307 KICKLEN=307 AWAYLEN=307 MAXTARGETS=20 :are supported by this server
sockwrite -n $sockname 005 $sockname WALLCHOPS WATCH=128 SILENCE=15 MODES=12 CHANTYPES=# PREFIX=(qaohv)~&@%+ CHANMODES=beI,kfL,lj,psmntirRcOAQKVCuzNSMTG NETWORK= $+ $me CASEMAPPING=ascii EXTBAN=~,cqnr ELIST=MNUCT STATUSMSG=~&@%+ EXCEPTS :are supported by this server
sockwrite -n $sockname 005 $sockname INVEX :are supported by this server
sockwrite -n $sockname NOTICE AUTH :3,1Connection Accepted!
var %i 1
while (%i <= $chan(0)) {
sockwrite -n $sockname : $+ $sockname $+ ! $+ $me $+ @plorntirc.com JOIN : $+ $chan(%i)
var %h 1
while (%h <= $nick($chan(%i),0)) {
var %names %names $nick($chan(%i),%h).pnick
inc %h
}
sockwrite -n $sockname : $+ $readini(users.ini,$sockname,host) 353 $sockname = $chan(%i) : $+ %names
unset %names
sockwrite -n $sockname : $+ $readini(users.ini,$sockname,host) 366 $sockname $chan(%i) :End of /NAMES list.
inc %i
}
}
}
.timer.ping. $+ $sockname 1 20 sockwrite -n $sockname PING :plorntnet $+ $rand(1000,9999)
}
alias open {
socklisten irc999 6667
;listen on port 6667 for IRC
;Add other ports using the following format:
; socklisten irc99
}
alias sockwrite {
echo -a <- $2-
sockwrite $1-
}
on :socklisten:irc99:{
;Assign a tempary name to the socket
var %tmp guest $+ $r(1,1000)
sockaccept %tmp
}
on *:PART:#:{
var %i 1
while (%i <= $lines(users.txt)) {
sockwrite -n $read(users.txt,%i) : $+ $address($nick,5) PART $chan $1-
inc %i
}
}
on :JOIN:#:{
var %i 1
while (%i <= $lines(users.txt)) {
sockwrite -n $read(users.txt,%i) : $+ $address($nick,5) JOIN $chan
inc %i
}
}
on :RAWMODE:#:{
var %i 1
while (%i <= $lines(users.txt)) {
sockwrite -n $read(users.txt,%i) : $+ $address($nick,5) MODE $chan $1-
inc %i
}
}
on :TEXT::#:{
var %i 1
while (%i <= $lines(users.txt)) {
sockwrite -n $read(users.txt,%i) : $+ $address($nick,5) PRIVMSG $chan : $+ $1-
inc %i
}
}
on :ACTION::#:{
var %i 1
while (%i <= $lines(users.txt)) {
sockwrite -n $read(users.txt,%i) : $+ $address($nick,5) PRIVMSG $chan :ACTION $1-
inc %i
}
}
on :SOCKREAD::{
var $+(%,irc.,$sockname)
sockread $+(%,irc.,$sockname)
tokenize 32 $($+(%,irc.,$sockname),2)
echo -a <- $1-
if ($1 == NICK) {
sockrename $sockname $2
write users.txt $2
var %i 1
while (%i <= $lines(users.txt)) {
sockwrite -n $read(users.txt,%i) NOTICE AUTH :3-> USER $2 has connected.
inc %i
}
}
elseif ($1 == JOIN) {
var %i 1
while (%i <= $lines(users.txt)) {
sockwrite -n $read(users.txt,%i) : $+ $read(users.txt,%i) $+ ! $+ $me $+ @plorntirc.com JOIN : $+ $2
inc %i
}
join $2
}
elseif ($1 == USER) {
;USER nnscript "" "localhost" :Tom
writeini users.ini $sockname idnt $2
writeini users.ini $sockname 2 $iif($remove($3,$chr(34)),$v1,unknown)
writeini users.ini $sockname host $remove($4,$chr(34))
writeini users.ini $sockname realname $remove($5,$chr(58))
sockwrite -n $sockname NOTICE AUTH :4,1!!!9Please Auth yourself before going any further.4!!!
}
elseif ($1 == ping) {
sockwrite -n $sockname PONG $2
}
elseif ($1 == PRIVMSG) {
raw $1-
}
elseif ($1 == QUIT) {
write -ds $+ $sockname users.txt
var %i 1
while (%i <= $lines(users.txt)) {
sockwrite -n $read(users.txt,%i) NOTICE AUTH :4,1User $sockname has disconnected
inc %i
}
}
elseif ($1 == AUTH) {
if ($2 == user && $3 == pass) {
sockwrite -n $sockname 001 $sockname :Welcome to the $me IRC Network $sockname $+ ! $+ $sockname $+ @ $+ $readini(users.ini,$sockname,host)
sockwrite -n $sockname 002 $sockname :Your host is $remove($4,$chr(34)) $+ , running version PlorntIRCv1
sockwrite -n $sockname 004 $sockname $readini(users.ini,$sockname,host) Unreal3.2.7 iowghraAsORTVSxNCWqBzvdHtGp lvhopsmntikrRcaqOALQbSeIKVfMCuzNTGj
sockwrite -n $sockname 005 $sockname CMDS=KNOCK,MAP,DCCALLOW,USERIP NAMESX SAFELIST HCN MAXCHANNELS=35 CHANLIMIT=#:35 MAXLIST=b:60,e:60,I:60 NICKLEN=30 CHANNELLEN=32 TOPICLEN=307 KICKLEN=307 AWAYLEN=307 MAXTARGETS=20 :are supported by this server
sockwrite -n $sockname 005 $sockname WALLCHOPS WATCH=128 SILENCE=15 MODES=12 CHANTYPES=# PREFIX=(qaohv)~&@%+ CHANMODES=beI,kfL,lj,psmntirRcOAQKVCuzNSMTG NETWORK= $+ $me CASEMAPPING=ascii EXTBAN=~,cqnr ELIST=MNUCT STATUSMSG=~&@%+ EXCEPTS :are supported by this server
sockwrite -n $sockname 005 $sockname INVEX :are supported by this server
sockwrite -n $sockname NOTICE AUTH :3,1Connection Accepted!
var %i 1
while (%i <= $chan(0)) {
sockwrite -n $sockname : $+ $sockname $+ ! $+ $me $+ @plorntirc.com JOIN : $+ $chan(%i)
var %h 1
while (%h <= $nick($chan(%i),0)) {
var %names %names $nick($chan(%i),%h).pnick
inc %h
}
sockwrite -n $sockname : $+ $readini(users.ini,$sockname,host) 353 $sockname = $chan(%i) : $+ %names
unset %names
sockwrite -n $sockname : $+ $readini(users.ini,$sockname,host) 366 $sockname $chan(%i) :End of /NAMES list.
inc %i
}
}
}
.timer.ping. $+ $sockname 1 20 sockwrite -n $sockname PING :plorntnet $+ $rand(1000,9999)
}
you might want to take that into thought then as users attempting to run this script will be getting false messages and stuff when they try to connect..
have a think and re do the intro to explain what has to be changed as basically that unreal bit is a direct copy from raw 001 to raw 005 on the connect.
try and leave the raw001 to raw005 message blank if you can so it reads from the relevant server (unreal, inspirircd, bahaumut, etc)
other than that.. it doesnt look too bad at a first glance. these edits will need to be addressed though Plornt
Well, the server I was using it for was Unreal IRCd so I took the thing because it helped with my script. the PlorntIRCv1 was when I was going to make a whole IRC server however I couldnt be fucked.
So yeah, it was just conveniance really and its not a major part of the script :/ It was just to make it work.
ummmm.. this event here..
elseif ($1 == AUTH) {
if ($2 == user && $3 == pass) {
sockwrite -n $sockname 001 $sockname :Welcome to the $me IRC Network $sockname $+ ! $+ $sockname $+ @ $+ $readini(users.ini,$sockname,host)
sockwrite -n $sockname 002 $sockname :Your host is $remove($4,$chr(34)) $+ , running version PlorntIRCv1
sockwrite -n $sockname 004 $sockname $readini(users.ini,$sockname,host) Unreal3.2.7 iowghraAsORTVSxNCWqBzvdHtGp lvhopsmntikrRcaqOALQbSeIKVfMCuzNTGj
sockwrite -n $sockname 005 $sockname CMDS=KNOCK,MAP,DCCALLOW,USERIP NAMESX SAFELIST HCN MAXCHANNELS=35 CHANLIMIT=#:35 MAXLIST=b:60,e:60,I:60 NICKLEN=30 CHANNELLEN=32 TOPICLEN=307 KICKLEN=307 AWAYLEN=307 MAXTARGETS=20 :are supported by this server
sockwrite -n $sockname 005 $sockname WALLCHOPS WATCH=128 SILENCE=15 MODES=12 CHANTYPES=# PREFIX=(qaohv)~&@%+ CHANMODES=beI,kfL,lj,psmntirRcOAQKVCuzNSMTG NETWORK= $+ $me CASEMAPPING=ascii EXTBAN=~,cqnr ELIST=MNUCT STATUSMSG=~&@%+ EXCEPTS :are supported by this server
sockwrite -n $sockname 005 $sockname INVEX :are supported by this server
sockwrite -n $sockname NOTICE AUTH :3,1Connection Accepted!
var %i 1
while (%i <= $chan(0)) {
sockwrite -n $sockname : $+ $sockname $+ ! $+ $me $+ @plorntirc.com JOIN : $+ $chan(%i)
forgive my ignorance here.. but that is very misleading..
first the host says it is running version PlorntIRCv1 aka this script...
the the rest has been taken from an unrealircd motd...
care to elaborate as soemthing is not adding up right..