mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-09 01:30:17 +08:00
Fix ContactMessage.nextMessageContaining
This commit is contained in:
parent
ed1a675caf
commit
cb535bb88d
@ -376,6 +376,7 @@ suspend inline fun <reified M : Message> ContactMessage.nextMessageContaining(
|
||||
): M {
|
||||
return subscribingGet<ContactMessage, ContactMessage>(timeoutMillis) {
|
||||
takeIf { this.isContextIdenticalWith(this@nextMessageContaining) }
|
||||
.takeIf { this.message.any<M>() }
|
||||
}.message.first()
|
||||
}
|
||||
|
||||
@ -388,6 +389,7 @@ inline fun <reified M : Message> ContactMessage.nextMessageContainingAsync(
|
||||
@Suppress("RemoveExplicitTypeArguments")
|
||||
subscribingGet<ContactMessage, ContactMessage>(timeoutMillis) {
|
||||
takeIf { this.isContextIdenticalWith(this@nextMessageContainingAsync) }
|
||||
.takeIf { this.message.any<M>() }
|
||||
}.message.first<M>()
|
||||
}
|
||||
}
|
||||
@ -408,6 +410,7 @@ suspend inline fun <reified M : Message> ContactMessage.nextMessageContainingOrN
|
||||
): M? {
|
||||
return subscribingGetOrNull<ContactMessage, ContactMessage>(timeoutMillis) {
|
||||
takeIf { this.isContextIdenticalWith(this@nextMessageContainingOrNull) }
|
||||
.takeIf { this.message.any<M>() }
|
||||
}?.message?.first()
|
||||
}
|
||||
|
||||
@ -419,6 +422,7 @@ inline fun <reified M : Message> ContactMessage.nextMessageContainingOrNullAsync
|
||||
return this.bot.async(coroutineContext) {
|
||||
subscribingGetOrNull<ContactMessage, ContactMessage>(timeoutMillis) {
|
||||
takeIf { this.isContextIdenticalWith(this@nextMessageContainingOrNullAsync) }
|
||||
.takeIf { this.message.any<M>() }
|
||||
}?.message?.first<M>()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user