kord icon indicating copy to clipboard operation
kord copied to clipboard

Add Auto Moderation

Open lukellmann opened this issue 2 years ago • 0 comments

Work still in progress.

The DSL for creating and editing AutoModerationRules looks like this:

// or other type instead of `Keyword`
// or rule.edit { ... }
val rule = guild.createKeywordAutoModerationRule("name") {

    // for `Keword` rules:
    // select one or multiple keywords that will trigger the rule
    keyword("cat")
    prefixKeyword("dog")
    suffixKeyword("owl")
    anywhereKeyword("fish")

    // for `KeywordPreset` rules:
    // select one or multiple presets
    preset(Profanity)
    // exempt substrings from triggering presets (optional)
    allowKeyword("hamster")

    // select one or multiple actions
    blockMessage()
    sendAlertMessage(channelId)
    timeout(42.minutes) // can only be used for `Keyword` rules

    // optional
    eventType = MessageSend
    enabled = true
    exemptRole(roleId)
    exemptChannel(channelId)
}

relevant doc commits / PRs / pages:

  • [ ] https://github.com/discord/discord-api-docs/commit/d3d478c64f2ecf57bcd0f77d5cce6bedee52d4d8 and https://discord.com/developers/docs/resources/auto-moderation
  • [x] https://github.com/discord/discord-api-docs/commit/36b9f2e1c692290264e88bbee4f2b8694c1129ce
  • [x] https://github.com/discord/discord-api-docs/pull/5090
  • [ ] https://github.com/discord/discord-api-docs/commit/b21abbe35a05a88334223b18d8407c8a97bb4ea7

lukellmann avatar Jul 06 '22 00:07 lukellmann