Documentation
¶
Index ¶
- type Rule
- func Always() *Rule
- func Command(prefixList ...string) *Rule
- func FullMatch(strs ...string) *Rule
- func Keyword(forceStart bool, keywords ...string) *Rule
- func Never() *Rule
- func Notice(typeList ...string) *Rule
- func OfType(typeName, adapterName string) *Rule
- func RegEx(pluginName string, exprs ...string) *Rule
- func ToMe() *Rule
- type RuleOp
- type Rules
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Rule ¶
type Rule struct {
// Return true if the message should be handled by the handler, false otherwise.
Filter func(msg message.Message) bool
Next *Rule
// Only useful when Next is not nil.
Operator RuleOp
}
Describes a filter rule, you can create your own rule by implementing this.
func Command ¶
Command creates a filter rule that matches if the raw message is a command and is in the prefixList.
func FullMatch ¶
FullMatch creates a filter rule that matches if the raw message is the same with one of the strings.
func Keyword ¶
Keyword creates a filter rule that matches if the raw message contains one of the keywords.
If forceStart is true, the keyword must be at the start of the message.
func Notice ¶
Notice filters messages with specified notice types.
Combines it with `ToMe` to filter notice messages directed to the bot.
func OfType ¶
OfType filters messages that has the specified type for specified adapter
You must be sure the message has at least one segment ¶
func RegEx ¶
RegEx creates a filter rule that matches if the raw message does match one of the RegEx expressions.
If you wrote a wrong RegEx expression, an error message with plugin name will be printed.