Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add regex support for Auto Moderation #713

Merged
merged 1 commit into from
Nov 8, 2022

Conversation

lukellmann
Copy link
Member

@lukellmann lukellmann commented Nov 5, 2022

The DSL looks like this:

val rule = guild.createKeywordAutoModerationRule("name") {
    regexPattern("^b(a|@)d\$w(o|0)rd(s|$)")
    blockMessage()
    enabled = true
}
println(rule.regexPatterns)

KeywordAutoModerationRuleBuilder.assignKeywords() was dropped and KeywordAutoModerationRuleBuilder.keywords was changed to var instead because it is no longer strictly required for creating rules. At least one of keywords or regexPatterns is required instead.

The builder documentation was also updated to include the limits documented in #5504.

see discord/discord-api-docs#5504

The DSL looks like this:
val rule = guild.createKeywordAutoModerationRule("name") {
    regexPattern("^b(a|@)d\$w(o|0)rd(s|$)")
    blockMessage()
    enabled = true
}
println(rule.regexPatterns)

KeywordAutoModerationRuleBuilder.assignKeywords() was dropped and
KeywordAutoModerationRuleBuilder.keywords was changed to var instead
because it is no longer strictly required for creating rules. At least
one of keywords or regexPatterns is required instead.

The builder documentation was also updated to include the limits
documented in #5504.

see discord/discord-api-docs#5504
@lukellmann lukellmann merged commit 828c924 into kordlib:0.8.x Nov 8, 2022
@lukellmann lukellmann deleted the automod-regex branch November 8, 2022 05:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant