kordlib / kord

Idiomatic Kotlin Wrapper for The Discord API
MIT License
926 stars 82 forks source link

Add `MemberProfileAutoModerationRule` #974

Closed lukellmann closed 1 month ago

lukellmann commented 2 months ago

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 https://github.com/discord/discord-api-docs/pull/6040

DRSchlaubi commented 2 months ago

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

lukellmann commented 2 months ago

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 commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

Nah I think that's fine

lukellmann commented 1 month ago

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.