Skip to content
This repository was archived by the owner on Mar 5, 2023. It is now read-only.

Commit e580734

Browse files
authored
Regex patterns automod rule trigger (bwmarrin#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.
1 parent 4ba7062 commit e580734

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

examples/auto_moderation/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ func main() {
3232
TriggerType: discordgo.AutoModerationEventTriggerKeyword,
3333
TriggerMetadata: &discordgo.AutoModerationTriggerMetadata{
3434
KeywordFilter: []string{"*cat*"},
35+
RegexPatterns: []string{"(c|b)at"},
3536
},
3637

3738
Enabled: &enabled,

structs.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,6 +1427,10 @@ type AutoModerationTriggerMetadata struct {
14271427
// Substrings which will be searched for in content.
14281428
// NOTE: should be only used with keyword trigger type.
14291429
KeywordFilter []string `json:"keyword_filter,omitempty"`
1430+
// Regular expression patterns which will be matched against content (maximum of 10).
1431+
// NOTE: should be only used with keyword trigger type.
1432+
RegexPatterns []string `json:"regex_patterns,omitempty"`
1433+
14301434
// Internally pre-defined wordsets which will be searched for in content.
14311435
// NOTE: should be only used with keyword preset trigger type.
14321436
Presets []AutoModerationKeywordPreset `json:"presets,omitempty"`

0 commit comments

Comments
 (0)