mIRC Home    About    Download    Register    News    Help

Print Thread
Socket's BOT #234973 18/11/11 03:55 PM
Joined: Nov 2011
Posts: 52
E
eawedat Offline OP
Babel fish
OP Offline
Babel fish
E
Joined: Nov 2011
Posts: 52
hey all
I have this code below:-

Code:
alias bot {
  if ($1- == $null) {
    echo -a Syntax: /bot <server>
    halt
  }
  else {
    set %server $1-
    sockopen bot %server 6667
    Echo -a Attempting connection: %server
  }
}

on 1:sockopen:bot:{
  if ($sockerr > 0) {
    sockclose $sockname
    echo -a No good, reconnecting bot!
    bot
  }
  else {
    sockwrite -n $sockname nick SocketBot
    sockwrite -n $sockname user SocketBot . . . SocketBot
  }
}

on 1:sockread:bot:{
  sockread %bot
  echo -a %bot
  ;sockwrite -n $sockname IDENT SocketBot
  if ($gettok(%bot,4,32) == :join) && ($gettok(%bot,5,32) != $null) {
    sockwrite -n $sockname join $gettok(%bot,5,32)
  }
  if ($gettok(%bot,1,32) == PING) {
    sockwrite -n $sockname pong $gettok(%bot,2,32)
  }
}


I get this result when trying to connect the bot to locahost "127.0.0.1"

Code:
Attempting connection: 127.0.0.1
:x NOTICE AUTH :*** Looking up your hostname...
:x NOTICE AUTH :*** Found your hostname (cached)
:x NOTICE AUTH :*** Checking ident...
PING :7C6A3F57
:x PRIVMSG SocketBot :VERSION
:x 465 SocketBot :*** You are not welcome on this server (Identd is required for this server.) Email x for more information.
ERROR :Closing Link: SocketBot[localhost] (You are banned)



so I added this command to send ident of bot to the server:
Code:
sockwrite -n $sockname IDENT SocketBot

on sockread , but when I uncomment it , I get this message from the server:-

Code:
Attempting connection: 127.0.0.1
:x NOTICE AUTH :*** Looking up your hostname...
:x NOTICE AUTH :*** Found your hostname (cached)
:x NOTICE AUTH :*** Checking ident...
PING :23065298
:x 451 IDENT :You have not registered
:x 451 IDENT :You have not registered
:x 451 IDENT :You have not registered
:x 451 IDENT :You have not registered
:x PRIVMSG SocketBot :VERSION
:x 465 SocketBot :*** You are not welcome on this server (Identd is required for this server.) Email x for more information.
ERROR :Closing Link: SocketBot[localhost] (You are banned)



help please..
thanks a lot.

Re: Socket's BOT [Re: eawedat] #234979 18/11/11 05:25 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
This should explain what you need to do and what exactly has to be sent:

http://www.team-clanx.org/articles/socketbot-ident.html


Invision Support
#Invision on irc.irchighway.net
Re: Socket's BOT [Re: Riamus2] #234981 18/11/11 05:34 PM
Joined: Nov 2011
Posts: 52
E
eawedat Offline OP
Babel fish
OP Offline
Babel fish
E
Joined: Nov 2011
Posts: 52
Riamus2 yeah I already seen that article I already put the code:

Code:
  tokenize 32 %_sb
  var %_ntoks = $numtok($1-,44)
  if (%_ntoks == 2 && $1,$3 isnum) {
    sockwrite -n $sockname $3 , $1 : USERID : UNIX : SocketBot
  }

inside the second version "which I already posted" but still not working!

the website/bot you posted to me is working 100% , but I am stuck to know what makes the second version does not work, so in that way I could get the sockets understood!


Re: Socket's BOT [Re: eawedat] #234987 18/11/11 08:47 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
I don't see any socklisten in yours.


Invision Support
#Invision on irc.irchighway.net