| View previous topic :: View next topic |
| Author |
Message |
BigToe Halfop
Joined: 30 Dec 2010 Posts: 99
|
Posted: Sat Jul 26, 2014 5:25 am Post subject: Ignore certain wildcards, but relay everything else |
|
|
Hi,
I'm using the following script to relay messages from one channel to another:
| Code: |
# Channel flag.
setudef flag monitorText2
# Subchannel.
set subchannel2 #channeltolisten
# Bind all text in all channels.
bind pubm - * monitorProc2
proc monitorProc2 {nick uhost hand chan text} {
global subchannel2
# Check channel flag.
if {![channel get $chan monitorText2]} {
return 0
}
# Check text for matching values.
if {[string match "*(Source:*" $text] } {
# Send matching text to subchannel.
putserv "PRIVMSG GianniInfantino :msg #channeltorelayto $text"
}
}
|
But in practice what I'm looking for is a script that will ignore certain wildcards/texts - and relay every message that does not match that wildcard/text.
Thanks |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Sat Jul 26, 2014 2:00 pm Post subject: |
|
|
Try this... | Code: |
### Set the channel to relay all qualifying text to! ###
set relayto #channeltorelayto
### Set any exempt masks for text that will not be relayed ###
### One exempt word, phrase, or mask per line! ###
set relayxmpt {
} ;## End of exempt masks setting ##
# Channel flag for all monitored channels.
# To flag a channel to be monitored, do: .chanset #yourchannel +relayText
setudef flag relayText
# Bind all text in all channels.
bind pubm - * relayMonitor
# Clean and split any exempt masks.
set relayxmpt [split [string trim $relayxmpt] "\n"]
proc relayMonitor {nk uh hn ch tx} {
# Check channel flag.
if {![channel get $ch relayText]} { return 0 }
# Check text for matching exempt.
foreach xmpt $::relayxmpt {
if {[string match -nocase $xmpt $tx]} { return 0 }
}
# Send any qualifying text to $relayto channel.
puthelp "PRIVMSG $::relayto :<$nk@$ch> $tx"
return 0
}
|
### Set any exempt masks for text that will not be relayed ###
### One exempt word, phrase, or mask per line! ###
Example:
| Code: | set relayxmpt {
hey
be back later
*(Source:*
} ;## End of exempt masks setting ## |
_________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
|
|
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
|
|