MessageSubscribersBuilder
open class MessageSubscribersBuilder<M : MessageEvent, out Ret, R : RR, RR>
Content copied to clipboard
消息订阅构造器
See also
Parameters
M
消息类型
R
消息监听器内部的返回值
Ret
每个 DSL 函数创建监听器之后的返回值
Types
ListeningFilter
Link copied to clipboard
由 contains, startsWith 等 DSL 创建出的监听条件, 使用 invoke 将其注册给事件
Functions
case
Link copied to clipboard
contains
Link copied to clipboard
containsAll
Link copied to clipboard
containsAny
Link copied to clipboard
endsWith
Link copied to clipboard
endsWithReply
Link copied to clipboard
finding
Link copied to clipboard
fun finding(regex: Regex): MessageSubscribersBuilder.ListeningFilter<M, Ret, R, RR>
Content copied to clipboard
消息内容可由正则表达式查找(Regex.find)
如果消息内容Regex.find 不为空
消息内容可由正则表达式查找(Regex.find), 就执行 onEvent
findingReply
Link copied to clipboard
open infix fun Regex.findingReply(replier: suspend M.(MatchResult) -> Any?): Ret
Content copied to clipboard
消息内容可由正则表达式查找(Regex.find), 则执行 replier 并将其返回值回复给发信对象.
matching
Link copied to clipboard
fun matching(regex: Regex): MessageSubscribersBuilder.ListeningFilter<M, Ret, R, RR>
Content copied to clipboard
消息内容可由正则表达式匹配(Regex.matchEntire)
fun matching(regex: Regex, onEvent: suspend M.(MatchResult) -> Unit): Ret
Content copied to clipboard
消息内容可由正则表达式匹配(Regex.matchEntire), 就执行 onEvent
matchingReply
Link copied to clipboard
open infix fun Regex.matchingReply(replier: suspend M.(MatchResult) -> Any?): Ret
Content copied to clipboard
消息内容可由正则表达式匹配(Regex.matchEntire), 则执行 replier 并将其返回值回复给发信对象.
newListeningFilter
Link copied to clipboard
open fun newListeningFilter(filter: M.(String) -> Boolean): MessageSubscribersBuilder.ListeningFilter<M, Ret, R, RR>
Content copied to clipboard
quoteReply
Link copied to clipboard
open infix fun MessageSubscribersBuilder.ListeningFilter<M, Ret, R, RR>.quoteReply(toReply: String): Ret
Content copied to clipboard
open infix fun MessageSubscribersBuilder.ListeningFilter<M, Ret, R, RR>.quoteReply(toReply: Message): Ret
Content copied to clipboard
open infix fun MessageSubscribersBuilder.ListeningFilter<M, Ret, R, RR>.quoteReply(replier: suspend M.(String) -> Any?): Ret
Content copied to clipboard
reply
Link copied to clipboard
open infix fun MessageSubscribersBuilder.ListeningFilter<M, Ret, R, RR>.reply(toReply: String): Ret
Content copied to clipboard
open infix fun MessageSubscribersBuilder.ListeningFilter<M, Ret, R, RR>.reply(message: Message): Ret
Content copied to clipboard
sentBy
Link copied to clipboard
fun sentBy(qq: Long): MessageSubscribersBuilder.ListeningFilter<M, Ret, R, RR>
Content copied to clipboard
fun sentBy(friend: User): MessageSubscribersBuilder.ListeningFilter<M, Ret, R, RR>
Content copied to clipboard
如果是这个人发的消息. 消息可以是好友消息也可以是群消息
fun sentBy(name: String): MessageSubscribersBuilder.ListeningFilter<M, Ret, R, RR>
Content copied to clipboard
如果是这个人发的消息. 消息目前只会是群消息
sentByAdministrator
Link copied to clipboard
fun sentByAdministrator(): MessageSubscribersBuilder.ListeningFilter<M, Ret, R, RR>
Content copied to clipboard
如果是管理员发的消息
sentByFriend
Link copied to clipboard
fun sentByFriend(): MessageSubscribersBuilder.ListeningFilter<M, Ret, R, RR>
Content copied to clipboard
如果是好友发来的消息
sentByGroupTemp
Link copied to clipboard
fun sentByGroupTemp(): MessageSubscribersBuilder.ListeningFilter<M, Ret, R, RR>
Content copied to clipboard
如果是群临时会话消息
sentByOperator
Link copied to clipboard
fun sentByOperator(): MessageSubscribersBuilder.ListeningFilter<M, Ret, R, RR>
Content copied to clipboard
如果是管理员或群主发的消息
sentByOwner
Link copied to clipboard
fun sentByOwner(): MessageSubscribersBuilder.ListeningFilter<M, Ret, R, RR>
Content copied to clipboard
如果是群主发的消息
sentByStranger
Link copied to clipboard
fun sentByStranger(): MessageSubscribersBuilder.ListeningFilter<M, Ret, R, RR>
Content copied to clipboard
fun sentByStranger(onEvent: MessageListener<StrangerMessageEvent, R>): Ret
Content copied to clipboard
如果是陌生人发来的消息
sentByTemp
Link copied to clipboard
Content copied to clipboard
如果是群临时会话消息
startsWith
Link copied to clipboard
fun startsWith(prefix: String, trim: Boolean = true): MessageSubscribersBuilder.ListeningFilter<M, Ret, R, RR>
Content copied to clipboard
fun startsWith(prefix: String, removePrefix: Boolean = true, trim: Boolean = true, onEvent: suspend M.(String) -> R): Ret
Content copied to clipboard
如果消息的前缀是 prefix
Properties
subscriber
Link copied to clipboard
invoke 这个 lambda 时, 它将会把 消息事件的处理器 注册给事件, 并返回注册完成返回的监听器.
Inheritors
MessageSelectBuilderUnit
Link copied to clipboard