| View previous topic :: View next topic |
| Author |
Message |
N30 Voice
Joined: 16 Jun 2009 Posts: 2
|
Posted: Tue Jun 16, 2009 9:53 am Post subject: How to use a tcl script on two #channels? |
|
|
How to edit "Set Chan " so i can use 2 #channels?
Script =
set listenport ""
# port for your script you want to listen on (you need to set same port in php script)
set password ""
# password (you need to set same password in php script)
set chan ""
# channel you want to send output to
listen $listenport script botlisten
proc botlisten {idx} {
control $idx botlisten2
}
proc botlisten2 {idx args} {
set args [join $args]
set password1 [lindex [split $args] 0]
set message [join [lrange [split $args] 1 end]]
if {[string match $::password $password1]} {
putquick "PRIVMSG $::chan :$message"
} else {
putlog "Unauthorized person tried to connect to the bot"
}
} |
|
| Back to top |
|
 |
raider2k Op
Joined: 01 Jan 2008 Posts: 140
|
Posted: Tue Jun 16, 2009 11:16 am Post subject: |
|
|
usually that one should do the trick, untested though:
| Code: |
Script =
set listenport ""
# port for your script you want to listen on (you need to set same port in php script)
set password ""
# password (you need to set same password in php script)
set multichannels [list #channel1 #channel2]
# channel you want to send output to
# add more channels if you want using the same way as above
listen $listenport script botlisten
proc botlisten {idx} {
control $idx botlisten2
}
proc botlisten2 {idx args} {
set args [join $args]
set password1 [lindex [split $args] 0]
set message [join [lrange [split $args] 1 end]]
if {[string match $::password $password1]} {
# NEW FROM HERE
foreach cchannel $::multichannels {
putquick "PRIVMSG $cchannel :$message"
# NEW END HERE
}
} else {
putlog "Unauthorized person tried to connect to the bot"
}
}
|
correct syntax ftw! |
|
| Back to top |
|
 |
N30 Voice
Joined: 16 Jun 2009 Posts: 2
|
Posted: Tue Jun 16, 2009 12:49 pm Post subject: |
|
|
Thank you! . Worked perfectly! |
|
| Back to top |
|
 |
raider2k Op
Joined: 01 Jan 2008 Posts: 140
|
Posted: Wed Jun 17, 2009 12:54 am Post subject: |
|
|
my pleasure, fine it works out
please also add [SOLVED] to your threads topic as a prefix if it has been solved  |
|
| Back to top |
|
 |
|