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 

Ignore certain wildcards, but relay everything else

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
BigToe
Halfop


Joined: 30 Dec 2010
Posts: 99

PostPosted: Sat Jul 26, 2014 5:25 am    Post subject: Ignore certain wildcards, but relay everything else Reply with quote

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
View user's profile Send private message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 792
Location: Tennessee, USA

PostPosted: Sat Jul 26, 2014 2:00 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests 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