| View previous topic :: View next topic |
| Author |
Message |
boehmi Voice
Joined: 11 Apr 2009 Posts: 14 Location: Germany
|
Posted: Mon Apr 13, 2009 5:10 pm Post subject: bind pub - * doesn't work |
|
|
I already have another problem
I want my bot to evaluate any string that is written to the channel with a procedure...
i used
| Code: | bind pub - * procedure
or
bind pub - "*" procedure |
but he binds the string "*" to procedure and not the wildcard *
What's my mistake? |
|
| Back to top |
|
 |
raider2k Op
Joined: 01 Jan 2008 Posts: 140
|
Posted: Mon Apr 13, 2009 6:10 pm Post subject: |
|
|
use pubm for that
| Quote: |
(6) PUBM (stackable)
bind pubm <flags> <mask> <proc>
procname <nick> <user@host> <handle> <channel> <text>
Description: just like MSGM, except it's triggered by things said
on a channel instead of things /msg'd to the bot. The mask is
matched against the channel name followed by the text and can
contain wildcards. Also, if a line triggers a PUB bind, it will not
trigger a PUBM bind.
Module: irc
|
|
|
| Back to top |
|
 |
Fill Halfop
Joined: 18 Jan 2009 Posts: 80
|
Posted: Mon Apr 13, 2009 6:10 pm Post subject: |
|
|
Well I don't like using pub, so I'd suggest you to use pubm (public text matching)
If you want to bind all channels, you'd have this:
| Code: |
bind pubm "* *" proc1
|
If you only want to bind in a specific chan, you must do it like this:
| Code: |
bind pubm "#channel1 *" proc1
|
proc1 will hava to be called with the arguments nick uhost hand chan text |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Thu Apr 16, 2009 3:39 pm Post subject: |
|
|
A suggestion when creating more complex patterns, use the % wildcard to match any channel instead of *.
The reason for this is that * matches 0 or more characters, including whitespaces, while % will match 1 word. The advantage of this usage becomes apparent when dealing with more complex patterns such as this:
| Code: | #We try to catch anything that starts with !hello world
bind pub "* !hello world*" pubm:hello
#Looks good eh? until we realize it will also trigger on "Blah !hello world", which we did not want!
bind pub "% !hello world*" pubm:hello
#Now, this works as intended. It'll only trigger when the text starts with "!hello world", not whenever it's anywhere in the text. |
This could also be extended to only trigger in local channels (&channel) by using "&% !hello world*", and so on... _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
|