mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-10 04:00:08 +08:00
Add MessageChain.findIsInstance
This commit is contained in:
parent
be6c67778e
commit
945bcc9b5b
@ -157,12 +157,19 @@ public inline fun MessageChain.noneContent(block: (MessageContent) -> Boolean):
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取第一个 [M] 类型的 [Message] 实例
|
||||
*/
|
||||
@JvmSynthetic
|
||||
public inline fun <reified M : SingleMessage?> MessageChain.findIsInstance(): M? =
|
||||
this.find { it is M } as M?
|
||||
|
||||
/**
|
||||
* 获取第一个 [M] 类型的 [Message] 实例
|
||||
*/
|
||||
@JvmSynthetic
|
||||
public inline fun <reified M : SingleMessage?> MessageChain.firstIsInstanceOrNull(): M? =
|
||||
this.firstOrNull { it is M } as M?
|
||||
this.find { it is M } as M?
|
||||
|
||||
/**
|
||||
* 获取第一个 [M] 类型的 [Message] 实例
|
||||
|
Loading…
Reference in New Issue
Block a user