open class MessageSubscribersBuilder<M : ContactMessage, out Ret, R : RR, RR>
消息订阅构造器
See Also
ListeningFilter |
由 contains, startsWith 等 DSL 创建出的监听条件, 使用 invoke 将其注册给事件 open inner class ListeningFilter<M : ContactMessage, out Ret, R : RR, RR> |
<init> |
消息订阅构造器 MessageSubscribersBuilder(stub: RR, subscriber: (M.(String) -> Boolean, MessageListener<M, RR>) -> Ret) |
subscriber |
invoke 这个 lambda 时, 它将会把 消息事件的处理器 注册给事件, 并返回注册完成返回的监听器. val subscriber: (M.(String) -> Boolean, MessageListener<M, RR>) -> Ret |
-> |
启动这个监听器, 在满足条件时回复原消息 open infix fun ListeningFilter<M, Ret, R, RR>.->(toReply: String): Ret open infix fun ListeningFilter<M, Ret, R, RR>.->(message: Message): Ret infix fun String. |
always |
无任何触发条件, 每次收到消息都执行 onEvent open fun always(onEvent: MessageListener<M, RR>): Ret |
at |
fun at(target: Long): ListeningFilter<M, Ret, R, RR>
fun at(target: User): ListeningFilter<M, Ret, R, RR> |
atAll |
fun atAll(): ListeningFilter<M, Ret, R, RR> |
atBot |
fun atBot(): ListeningFilter<M, Ret, R, RR>
消息内容包含目标为 Bot 的 At, 就执行 onEvent fun atBot(onEvent: suspend M.(String) -> R): Ret |
case |
fun case(equals: String, ignoreCase: Boolean = false, trim: Boolean = true): ListeningFilter<M, Ret, R, RR> fun case(equals: String, ignoreCase: Boolean = false, trim: Boolean = true, onEvent: MessageListener<M, R>): Ret |
contains |
fun contains(sub: String, ignoreCase: Boolean = false): ListeningFilter<M, Ret, R, RR>
fun contains(sub: String, ignoreCase: Boolean = false, trim: Boolean = true, onEvent: MessageListener<M, R>): Ret fun |
containsAll |
fun containsAll(vararg sub: String, ignoreCase: Boolean = false, trim: Boolean = true): ListeningFilter<M, Ret, R, RR> fun |
containsAny |
fun containsAny(vararg sub: String, ignoreCase: Boolean = false, trim: Boolean = true): ListeningFilter<M, Ret, R, RR> fun |
containsReply |
open infix fun String.containsReply(reply: String): Ret
消息内容包含 this 则执行 replier 并将其返回值回复给发信对象. open infix fun String.containsReply(replier: suspend M.(String) -> Any?): Ret |
content |
如果 filter 返回 fun content(filter: M.(String) -> Boolean): ListeningFilter<M, Ret, R, RR> |
endsWith |
如果消息的结尾是 suffix fun endsWith(suffix: String, trim: Boolean = true): ListeningFilter<M, Ret, R, RR> fun endsWith(suffix: String, removeSuffix: Boolean = true, trim: Boolean = true, onEvent: suspend M.(String) -> R): Ret |
endsWithReply |
不考虑空格, 消息内容以 this 结尾则执行 replier 并将其返回值回复给发信对象. open infix fun String.endsWithReply(replier: suspend M.(String) -> Any?): Ret |
finding |
如果消息内容 Regex.find 不为空 infix fun Regex.finding(block: suspend M.(MatchResult) -> R): Ret
消息内容可由正则表达式查找(Regex.find) fun finding(regex: Regex): ListeningFilter<M, Ret, R, RR>
消息内容可由正则表达式查找(Regex.find), 就执行 fun finding(regex: Regex, onEvent: suspend M.(MatchResult) -> Unit): Ret |
findingReply |
消息内容可由正则表达式查找(Regex.find), 则执行 replier 并将其返回值回复给发信对象. open infix fun Regex.findingReply(replier: suspend M.(MatchResult) -> Any?): Ret |
has |
fun <N : Message> has(onEvent: suspend M.(N) -> R): Ret
fun <N : Message> has(): ListeningFilter<M, Ret, R, RR> |
invoke |
operator fun String.invoke(block: MessageListener<M, R>): Ret |
mapping |
open fun <N : Any> mapping(mapper: M.(String) -> N?, onEvent: suspend M.(N) -> R): Ret |
matching |
infix fun Regex.matching(block: MessageListener<M, R>): Ret
消息内容可由正则表达式匹配(Regex.matchEntire) fun matching(regex: Regex): ListeningFilter<M, Ret, R, RR>
消息内容可由正则表达式匹配(Regex.matchEntire), 就执行 fun matching(regex: Regex, onEvent: suspend M.(MatchResult) -> Unit): Ret |
matchingReply |
消息内容可由正则表达式匹配(Regex.matchEntire), 则执行 replier 并将其返回值回复给发信对象. open infix fun Regex.matchingReply(replier: suspend M.(MatchResult) -> Any?): Ret |
newListeningFilter |
open fun newListeningFilter(filter: M.(String) -> Boolean): ListeningFilter<M, Ret, R, RR> |
quoteReply |
启动这个监听器, 在满足条件时引用回复原消息 open infix fun ListeningFilter<M, Ret, R, RR>.quoteReply(toReply: String): Ret open infix fun ListeningFilter<M, Ret, R, RR>.quoteReply(toReply: Message): Ret
启动这个监听器, 在满足条件时执行 replier 并引用回复原消息 open infix fun ListeningFilter<M, Ret, R, RR>.quoteReply(replier: suspend M.(String) -> Any?): Ret |
reply |
启动这个监听器, 在满足条件时回复原消息 open infix fun ListeningFilter<M, Ret, R, RR>.reply(toReply: String): Ret open infix fun ListeningFilter<M, Ret, R, RR>.reply(message: Message): Ret open infix fun ListeningFilter<M, Ret, R, RR>.reply(replier: suspend M.(String) -> Any?): Ret
open infix fun String.reply(reply: String): Ret open infix fun String.reply(reply: Message): Ret
当发送的消息内容为 this 就执行并回复 replier 的返回值 open infix fun String.reply(replier: suspend M.(String) -> Any?): Ret |
sentBy |
如果是这个人发的消息. 消息目前只会是群消息 fun sentBy(name: String): ListeningFilter<M, Ret, R, RR>
如果是这个人发的消息. 消息可以是好友消息也可以是群消息 fun sentBy(qq: Long): ListeningFilter<M, Ret, R, RR> fun sentBy(friend: User): ListeningFilter<M, Ret, R, RR> fun sentBy(qq: Long, onEvent: MessageListener<M, R>): Ret fun |
sentByAdministrator |
如果是管理员发的消息 fun sentByAdministrator(): ListeningFilter<M, Ret, R, RR> fun |
sentByFriend |
如果是好友发来的消息 fun sentByFriend(onEvent: MessageListener<FriendMessage, R>): Ret fun sentByFriend(): ListeningFilter<M, Ret, R, RR> |
sentByOperator |
如果是管理员或群主发的消息 fun sentByOperator(): ListeningFilter<M, Ret, R, RR> fun |
sentByOwner |
如果是群主发的消息 fun sentByOwner(): ListeningFilter<M, Ret, R, RR> fun |
sentByTemp |
如果是好友发来的消息 fun sentByTemp(): ListeningFilter<M, Ret, R, RR> |
sentFrom |
如果是来自这个群的消息 fun sentFrom(groupId: Long): ListeningFilter<M, Ret, R, RR> fun sentFrom(group: Group): ListeningFilter<M, Ret, R, RR> fun |
startsWith |
如果消息的前缀是 prefix fun startsWith(prefix: String, trim: Boolean = true): ListeningFilter<M, Ret, R, RR> fun startsWith(prefix: String, removePrefix: Boolean = true, trim: Boolean = true, onEvent: suspend M.(String) -> R): Ret |
startsWithReply |
不考虑空格, 消息内容以 this 开始则执行 replier 并将其返回值回复给发信对象. open infix fun String. |
MessageSelectBuilderUnit |
selectMessagesUnit 或 selectMessages 时的 DSL 构建器. abstract class MessageSelectBuilderUnit<M : ContactMessage, R> : MessageSubscribersBuilder<M, Unit, R, Any?> |