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:
Fedor Lapshin 2022-11-17 00:57:13 +03:00 committed by GitHub
parent 4ba7062176
commit e580734d0b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View file

@ -32,6 +32,7 @@ func main() {
TriggerType: discordgo.AutoModerationEventTriggerKeyword,
TriggerMetadata: &discordgo.AutoModerationTriggerMetadata{
KeywordFilter: []string{"*cat*"},
RegexPatterns: []string{"(c|b)at"},
},
Enabled: &enabled,

View file

@ -1427,6 +1427,10 @@ type AutoModerationTriggerMetadata struct {
// Substrings which will be searched for in content.
// NOTE: should be only used with keyword trigger type.
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.
// NOTE: should be only used with keyword preset trigger type.
Presets []AutoModerationKeywordPreset `json:"presets,omitempty"`