egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

socket bot help..

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
sdays
Halfop


Joined: 21 Oct 2006
Posts: 98

PostPosted: Fri Feb 09, 2007 4:38 am    Post subject: socket bot help.. Reply with quote

Can some one help me with this socket bot..

i get:

Code:

<eggdrop> [02:46] Tcl error [socket:add]: missing close-bracket


Code:

bind pub - !addbot socket:add

proc socket:add {nick uhost hand chan} {
  global nick realname username socket:chan socket:serv socket:nick socket:conn
  set socketnick $nick[rand 1000]
  set chan "$text0"
  set serv "text1"
  set port "text2"
  if {![validchan $chan]} {
    putserv "NOTICE $nick :Invalid Channel"
    putserv "NOTICE $nick :usage: !addbot <channel> <server> \[port\]"
    } else {
    if {$serv == ""} {
      putserv "NOTICE $nick :Specify a Server"
      putserv "NOTICE $nick :usage: !addbot <channel> <server> \[port\]"
      } else {
      if {[info exists $socket:conn]} {
        if {[valididx $socket:conn} {
          putserv "NOTICE $nick :QUIT :Switching Servers"
          killdcc $socket:conn
        }
      }
      if {$port == ""} {
        set socket:conn [connect $serv 6667]
        } else {
        if {$port != ""} {set socket:conn [connect $serv $port]}
      }
      set socket:chan $chan
      set socket:serv $serv
      putlc "USER $username 0 0 :$realname"
      putlc "NICK :$socket:nick"
    }
    return 1
  }
}
Back to top
View user's profile Send private message
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Fri Feb 09, 2007 5:18 am    Post subject: Reply with quote

If you indented your code properly, you'd be able to find the missing close bracket.
Back to top
View user's profile Send private message
sdays
Halfop


Joined: 21 Oct 2006
Posts: 98

PostPosted: Fri Feb 09, 2007 5:56 am    Post subject: Reply with quote

Im not really good a tcl scripting..
Back to top
View user's profile Send private message
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Fri Feb 09, 2007 6:19 am    Post subject: Reply with quote

sdays wrote:
Im not really good a tcl scripting..

For every open brace '{' there has to be a matching closing one '}'.
_________________
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Back to top
View user's profile Send private message Visit poster's website
sdays
Halfop


Joined: 21 Oct 2006
Posts: 98

PostPosted: Fri Feb 09, 2007 6:22 am    Post subject: Reply with quote

Ok i fix that part but now it, now won't connect to irc..


Code:

bind pub - !addbot socket:add

proc socket:add {nick uhost hand chan arg} {
  global realname username socket:chan socket:serv socket:conn
  set nick [lindex $arg 0]
  set chan [lindex $arg 1]
  set serv [lindex $arg 2]
  set port [lindex $arg 3]
  if {![validchan $chan]} {
    putserv "NOTICE $nick :Invalid Channel"
    putserv "NOTICE $nick :usage: !addbot <nick> <channel> <server> \[port\]"
    } else {
    if {$serv == ""} {
      putserv "NOTICE $nick :Specify a Server"
      putserv "NOTICE $nick :usage: !addbot <nick> <channel> <server> \[port\]"
    }
  }
  if {$port == ""} {
    set socket:conn [connect $serv 6667]
    } else {
    if {$port != ""} {set socket:conn [connect $serv $port]}
  }
  set socket:chan $chan
  set socket:serv $serv
  puts "USER $username 0 0 :$realname"
  puts "NICK :$nick"
}
return 1
}
Back to top
View user's profile Send private message
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Fri Feb 09, 2007 6:24 am    Post subject: Reply with quote

Post the results of:
Code:
.set errorInfo

_________________
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Back to top
View user's profile Send private message Visit poster's website
sdays
Halfop


Joined: 21 Oct 2006
Posts: 98

PostPosted: Fri Feb 09, 2007 6:35 am    Post subject: Reply with quote

i get this <eggdrop> Currently: wrong # args: should be "error message ?errorInfo? ?errorCode?"
Back to top
View user's profile Send private message
sdays
Halfop


Joined: 21 Oct 2006
Posts: 98

PostPosted: Fri Feb 09, 2007 6:54 am    Post subject: Reply with quote

Btw im wanting this tcl so it check for invite spam every 10 mins or so..
Back to top
View user's profile Send private message
user
 


Joined: 18 Mar 2003
Posts: 1452
Location: Norway

PostPosted: Fri Feb 09, 2007 10:04 am    Post subject: Reply with quote

sdays wrote:
Btw im wanting this tcl so it check for invite spam every 10 mins or so..

http://www.demond.net/spambuster.tcl
_________________
Have you ever read "The Manual"?
Back to top
View user's profile Send private message
sdays
Halfop


Joined: 21 Oct 2006
Posts: 98

PostPosted: Fri Feb 09, 2007 1:23 pm    Post subject: Reply with quote

hmm thats not what im looking for im wanting it on a socket bot
Back to top
View user's profile Send private message
user
 


Joined: 18 Mar 2003
Posts: 1452
Location: Norway

PostPosted: Fri Feb 09, 2007 1:27 pm    Post subject: Reply with quote

sdays wrote:
hmm thats not what im looking for im wanting it on a socket bot

Then why are you using 'connect'? demond's script does what you claim to be trying to do.
http://www.demond.net/spambuster.tcl wrote:
# this will fork a clone to scan for spam on bot's own channels
...using 'connect' to make the tcp connection
_________________
Have you ever read "The Manual"?
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Fri Feb 09, 2007 3:11 pm    Post subject: Reply with quote

Might be worth mentioning, that you currently mix tcl's I/O mechanisms with eggdrop's own socket-implementations. They are not compatible; ie. you cannot use 'puts' with sockets opened with 'connect' or 'listen'. In the same fashion, you cannot use 'putidx' or 'control' with sockets created with the 'socket' command.

Each method has it own advantages and disadvantages; so I'd suggest you read up on both and decide on which to use before you proceed with coding this script.

Also, on a sidenote, I can't stress enough how bad it is to use list-commands (such as 'lindex') on strings. Please use 'split' to convert strings into lists when neccesary.
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber