this is now instance of GroupMessage for sentFrom

This commit is contained in:
Him188 2020-02-02 23:30:37 +08:00
parent 5d46d1c4be
commit ab4a0c82d6

View File

@ -398,8 +398,10 @@ class MessageSubscribersBuilder<T : MessagePacket<*, *>>(
* 如果是来自这个群的消息, 就执行 [onEvent]
*/
@MessageDsl
inline fun sentFrom(groupId: Long, crossinline onEvent: MessageListener<T>): Listener<T> =
content({ this is GroupMessage && this.group.id == groupId }, onEvent)
inline fun sentFrom(groupId: Long, crossinline onEvent: MessageListener<GroupMessage>): Listener<T> =
content({ this is GroupMessage && this.group.id == groupId }){
onEvent(this as GroupMessage, it)
}
/**
* 如果消息内容包含 [M] 类型的 [Message]