[A] - Basic Socket Bot (V1.0B#2004)

By Advanced on Oct 05, 2004

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 }

Comments

Sign in to comment.
sk68   -  Jul 29, 2010

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) }
 Respond  
DICE   -  Feb 11, 2010

To Who Ever Scripted This Script
Weldone
I Like It Very Much
Simple But Effective
ive done my own alterations to it to suit me
but uve saved me time in making my own
i like the simplicity of the code and cleaniness
keep it up who ever you are
you got my thumbs up ;)

 Respond  
Viper01   -  Oct 25, 2007

sockets still confuse me like theres no tomorrow (I hardly understand aliases) but i\'ve accidentally made a working google script before(which i lost... lol) so i might get lucky a second time :P

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.