This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Port From Site to Eggdrop?

General support and discussion of Eggdrop bots.
Post Reply
W
W33dman
Voice
Posts: 1
Joined: Mon Jul 19, 2010 11:06 am

Port From Site to Eggdrop?

Post by W33dman »

Hello all,

First let me say thank you for Eggdrop! Just got it up and running yesterday and having lots of fun with it...the options are endless.

Now my website has a built in option to connect to the eggdrop and use it to announce things on the site in IRC. I am just not sure what port to specify and tell it connect to eggdrop with as their are a few different options and so far the ports I have tried did not seem to work.

Thanks
W33dman
M
MIODude
Voice
Posts: 32
Joined: Mon Oct 09, 2006 6:26 pm

Post by MIODude »

You should create a separate script for that function, and you want to specify the listen port in that script

Code: Select all


listen xxxx script botlisten

set password "password"

proc botlisten {idx} {
    control $idx botlisten2
}

proc botlisten2 {idx args} {

    set args [string map { "\\" "" } $args]
    set args [join $args]
    set password1 [lindex [split $args] 0]
    set message [join [lrange [split $args] 1 end]]

  if {[string match $::password $password1]} {
        putnow "PRIVMSG #channel :$message"
 } else {
    putlog "Unauthorized person tried to connect to the bot"
    }
}


like that. Where XXXX is the port. Make it different than any port you are loading in your eggdrop config. The website would telnet the data to the port defined in this script
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

A comment on the posted code:

Avoid using the name "args" for proc arguments, as it is handled in a different manner. Basically, it will accept 0 or more parameters, each provided as a list entity - whereas normal argument names only takes one.

In the case of control, the command/proc is always called with two parameters - idx and text - so there is no need for args here. Further, using commands such as string map on a list is a bad idea, as this might very well break the (delicate) list structure.

I'd recommend something like this:

Code: Select all

proc botlisten2 {idx text} {

  set params [split $text]
  set password1 [lindex $params 0]
  set message [join [lrange $params 1 end]]
...
NML_375
Post Reply