Filter

annotation class Filter(val value: String = "", val mode: FilterMode = FilterMode.IN_LISTENER, val priority: Int = PriorityConstant.DEFAULT, val targets: Array<Filter.Targets> = [], val ifNullPass: Boolean = false, val matchType: MatchType = MatchType.REGEX_MATCHES, val regexOptions: Array<RegexOption> = [])(source)

与 @Listener 配合使用,标记为对当前事件处理器的基础属性过滤器。

Types

Link copied to clipboard
@Target(allowedTargets = [])
annotation class Targets(val components: Array<String> = [], val bots: Array<String> = [], val actors: Array<String> = [], val authors: Array<String> = [], val chatRooms: Array<String> = [], val organizations: Array<String> = [], val groups: Array<String> = [], val guilds: Array<String> = [], val contacts: Array<String> = [], val ats: Array<String> = [], val atBot: Boolean = false)

针对部分特定目标的过滤匹配。

Properties

Link copied to clipboard
val ifNullPass: Boolean = false

当 value 对消息事件进行匹配时, 如果消息的 纯文本内容 为 null, 是否直接放行。如果为 true, 则纯文本内容为 null 的时候视为匹配通过,反之则为匹配失败。默认为 false。 此参数只有当 value 不为空的时候有效。

Link copied to clipboard

针对匹配目标所使用的匹配规则。 默认情况下使用 正则完全匹配.

Link copied to clipboard

Filter 所产生的“过滤器”的实现模式。默认为注入到事件处理器逻辑之前。

Link copied to clipboard

优先级。 当 mode 为 FilterMode.INTERCEPTOR 时代表其作为拦截器注册时的优先级。

Link copied to clipboard

如果 matchType 是与正则匹配相关的类型,则 regexOptions 会作为正则对象 Regex 的 Regex.options 提供。

Link copied to clipboard

针对部分特定目标的过滤匹配。

Link copied to clipboard

基于一定规则,对 消息事件 的 纯文本内容 进行逻辑匹配。

Inherited functions

Link copied to clipboard