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

[Automod] Add support for regex matching #5504

Merged
merged 4 commits into from
Nov 4, 2022
Merged

[Automod] Add support for regex matching #5504

merged 4 commits into from
Nov 4, 2022

Conversation

hemu
Copy link
Contributor

@hemu hemu commented Sep 29, 2022

Draft PR for upcoming change to allow defining regex patterns in Automod rules with
trigger_type == KEYWORD.

This feature is not finalized yet and is still subject to change. This will be left as a Draft PR until then.

@hemu hemu force-pushed the hemu/add-automod-regex branch 2 times, most recently from dc7a2f6 to 51cb5a3 Compare September 29, 2022 13:12
@shaydewael shaydewael added the not released This issue or PR is referencing a change that is not yet widely released and/or subject to change. label Sep 29, 2022
Copy link
Contributor

@onerandomusername onerandomusername left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this implies that we can set keyword filters and regex patterns for the same rule, is this correct?

@hemu
Copy link
Contributor Author

hemu commented Oct 7, 2022

this implies that we can set keyword filters and regex patterns for the same rule, is this correct?

yep, thats right

@hemu hemu force-pushed the hemu/add-automod-regex branch from 51cb5a3 to 4086c7a Compare November 4, 2022 20:10
@hemu hemu marked this pull request as ready for review November 4, 2022 20:28
@hemu
Copy link
Contributor Author

hemu commented Nov 4, 2022

Going to merge this in. If ya'll notice I missed something or documented something incorrectly (like missing JSON escaping the backslash in the example -- ty Rapptz and MinnDevelopment for catching that 🙂) feel free to comment here after and ping me.

@hemu hemu force-pushed the hemu/add-automod-regex branch from 5e5266f to 4a09e29 Compare November 4, 2022 21:27
@Lulalaby
Copy link
Contributor

Lulalaby commented Nov 4, 2022

Looks good hemu 👌

@hemu hemu force-pushed the hemu/add-automod-regex branch from 4a09e29 to 4a9d744 Compare November 4, 2022 21:33
@hemu hemu merged commit 015d2af into main Nov 4, 2022
@hemu hemu deleted the hemu/add-automod-regex branch November 4, 2022 21:35
@onerandomusername
Copy link
Contributor

This still has the not-released label?

onerandomusername added a commit to DisnakeDev/disnake that referenced this pull request Nov 4, 2022
lukellmann added a commit to lukellmann/kord that referenced this pull request 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
@hemu hemu removed the not released This issue or PR is referencing a change that is not yet widely released and/or subject to change. label Nov 7, 2022
@hemu
Copy link
Contributor Author

hemu commented Nov 7, 2022

This still has the not-released label?

removed, ty for catching that

lukellmann added a commit to kordlib/kord that referenced this pull request Nov 8, 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
Nihlus added a commit to Remora/Remora.Discord that referenced this pull request Nov 17, 2022
VelvetToroyashi pushed a commit to VelvetToroyashi/Remora.Discord that referenced this pull request Dec 2, 2022
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.

6 participants