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 MemberProfileAutoModerationRule #974

Merged
merged 3 commits into from
Sep 19, 2024
Merged

Add MemberProfileAutoModerationRule #974

merged 3 commits into from
Sep 19, 2024

Conversation

lukellmann
Copy link
Member

The DSL for creating/editing MemberProfileAutoModerationRules looks like this:

val rule = guild.createMemberProfileAutoModerationRule("name") {
    anywhereKeyword("cat")
    regexPattern("^b(a|@)d\$w(o|0)rd(s|$)")
    allowPrefixKeyword("black cat")
    blockMemberInteraction()
    sendAlertMessage(channelId)
    enabled = true
}
println(rule)

See discord/discord-api-docs#6040

The DSL for creating/editing MemberProfileAutoModerationRules looks like
this:

val rule = guild.createMemberProfileAutoModerationRule("name") {
    anywhereKeyword("cat")
    regexPattern("^b(a|@)d\$w(o|0)rd(s|$)")
    allowPrefixKeyword("black cat")
    blockMemberInteraction()
    sendAlertMessage(channelId)
    enabled = true
}
println(rule)

See discord/discord-api-docs#6040
@lukellmann lukellmann requested a review from DRSchlaubi August 30, 2024 22:07
@DRSchlaubi
Copy link
Member

I think an @Language("regexp") should be used, which should be doable using @OptionalExpectation

@lukellmann
Copy link
Member Author

I think an @Language("regexp") should be used, which should be doable using @OptionalExpectation

does this work for rust regex? auto mod supposedly uses rust regex syntax.

@DRSchlaubi
Copy link
Member

I think an @Language("regexp") should be used, which should be doable using @OptionalExpectation

does this work for rust regex? auto mod supposedly uses rust regex syntax.

regexp is simply the name the regex plugin uses, it stands for RegularExpression, not regexp

@lukellmann
Copy link
Member Author

I think an @Language("regexp") should be used, which should be doable using @OptionalExpectation

does this work for rust regex? auto mod supposedly uses rust regex syntax.

regexp is simply the name the regex plugin uses, it stands for RegularExpression, not regexp

yes, i know. the concern that i'm having is that @Language("RegExp") is for java.util.regex.Pattern and the regex syntax might be different from rust's regex::Regex (or whatever discord uses).

@DRSchlaubi
Copy link
Member

Nah I think that's fine

# Conflicts:
#	rest/api/rest.klib.api
@lukellmann
Copy link
Member Author

hm, i'm not sure if it's really worth the effort of an expect/actual annotation. even less if it might even provide slightly wrong results.

# Conflicts:
#	core/src/commonMain/kotlin/Unsafe.kt
@lukellmann lukellmann merged commit 12f3249 into main Sep 19, 2024
4 checks passed
@lukellmann lukellmann deleted the member-profile-rule branch September 19, 2024 13:03
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.

2 participants