| View previous topic :: View next topic |
| Author |
Message |
Wuff Voice

Joined: 10 Oct 2007 Posts: 7
|
Posted: Sat Nov 17, 2007 2:06 pm Post subject: Ignore a channel in a "foreach chan" loop |
|
|
| Code: | bind bot - announce botannounce
bind msg m announce gotannounce
proc announce {text} {
foreach chan [channels] {
if {[botonchan $chan]} {
puthelp "privmsg $chan :$text"
}
}
}
proc botannounce {from cmd text} {
announce $text
}
proc gotannounce {nick uhost hand text} {
putallbots "announce $text"
}
|
I simply want the bot not to post the message on a specific channel, when it runs through all the channels it's on.
I think it's something like: if ![$chan = "#channel"]
But I'm really not sure.
If someone could allso give me an example on how to ignore multiple channels, that would be great, but I would be happy if the script just ignores the one channel
Thanks in advance |
|
| Back to top |
|
 |
rosc2112 Revered One

Joined: 19 Feb 2006 Posts: 1454 Location: Northeast Pennsylvania
|
Posted: Sat Nov 17, 2007 5:10 pm Post subject: |
|
|
| Code: |
if {([botonchan $chan]) && ($chan != "#mychannel")} {
|
|
|
| Back to top |
|
 |
Wuff Voice

Joined: 10 Oct 2007 Posts: 7
|
Posted: Sat Nov 17, 2007 6:23 pm Post subject: |
|
|
| Great.. Thank you |
|
| Back to top |
|
 |
rosc2112 Revered One

Joined: 19 Feb 2006 Posts: 1454 Location: Northeast Pennsylvania
|
Posted: Sat Nov 17, 2007 9:51 pm Post subject: Re: Ignore a channel in a "foreach chan" loop |
|
|
| Wuff wrote: | | If someone could allso give me an example on how to ignore multiple channels |
I didn't see this part earlier. I would do this:
| Code: |
# list of channels to make announcements on
set mychanlist "#chan1 #chan2 #chan3 #etc"
proc announce {text} {
foreach chan $::mychanlist {
if {[botonchan $chan]} {
puthelp "privmsg $chan :$text"
}
}
}
|
|
|
| Back to top |
|
 |
|