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