Commit ab4a0c82 authored by Him188's avatar Him188

`this` is now instance of `GroupMessage` for `sentFrom`

parent 5d46d1c4
...@@ -398,8 +398,10 @@ class MessageSubscribersBuilder<T : MessagePacket<*, *>>( ...@@ -398,8 +398,10 @@ class MessageSubscribersBuilder<T : MessagePacket<*, *>>(
* 如果是来自这个群的消息, 就执行 [onEvent] * 如果是来自这个群的消息, 就执行 [onEvent]
*/ */
@MessageDsl @MessageDsl
inline fun sentFrom(groupId: Long, crossinline onEvent: MessageListener<T>): Listener<T> = inline fun sentFrom(groupId: Long, crossinline onEvent: MessageListener<GroupMessage>): Listener<T> =
content({ this is GroupMessage && this.group.id == groupId }, onEvent) content({ this is GroupMessage && this.group.id == groupId }){
onEvent(this as GroupMessage, it)
}
/** /**
* 如果消息内容包含 [M] 类型的 [Message] * 如果消息内容包含 [M] 类型的 [Message]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment