Regex patterns automod rule trigger (#1275)
* feat: add regex pattern automod trigger Add regex patterns metadata to AutoModerationTriggerMetadata. * feat: add regex pattern example Add showcase of regex filter into auto_moderation example. * feat: cosmetic changes Add period to the end of RegexPatterns documentation comment.
This commit is contained in:
parent
4ba7062176
commit
e580734d0b
2 changed files with 5 additions and 0 deletions
|
@ -32,6 +32,7 @@ func main() {
|
||||||
TriggerType: discordgo.AutoModerationEventTriggerKeyword,
|
TriggerType: discordgo.AutoModerationEventTriggerKeyword,
|
||||||
TriggerMetadata: &discordgo.AutoModerationTriggerMetadata{
|
TriggerMetadata: &discordgo.AutoModerationTriggerMetadata{
|
||||||
KeywordFilter: []string{"*cat*"},
|
KeywordFilter: []string{"*cat*"},
|
||||||
|
RegexPatterns: []string{"(c|b)at"},
|
||||||
},
|
},
|
||||||
|
|
||||||
Enabled: &enabled,
|
Enabled: &enabled,
|
||||||
|
|
|
@ -1427,6 +1427,10 @@ type AutoModerationTriggerMetadata struct {
|
||||||
// Substrings which will be searched for in content.
|
// Substrings which will be searched for in content.
|
||||||
// NOTE: should be only used with keyword trigger type.
|
// NOTE: should be only used with keyword trigger type.
|
||||||
KeywordFilter []string `json:"keyword_filter,omitempty"`
|
KeywordFilter []string `json:"keyword_filter,omitempty"`
|
||||||
|
// Regular expression patterns which will be matched against content (maximum of 10).
|
||||||
|
// NOTE: should be only used with keyword trigger type.
|
||||||
|
RegexPatterns []string `json:"regex_patterns,omitempty"`
|
||||||
|
|
||||||
// Internally pre-defined wordsets which will be searched for in content.
|
// Internally pre-defined wordsets which will be searched for in content.
|
||||||
// NOTE: should be only used with keyword preset trigger type.
|
// NOTE: should be only used with keyword preset trigger type.
|
||||||
Presets []AutoModerationKeywordPreset `json:"presets,omitempty"`
|
Presets []AutoModerationKeywordPreset `json:"presets,omitempty"`
|
||||||
|
|
Loading…
Reference in a new issue