mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-23 06:10:30 +08:00
Fix MessageChainBuilder.addAndCheckConstrainSingle
This commit is contained in:
parent
5c8e995d78
commit
7015f0f4e9
@ -63,8 +63,13 @@ class MessageChainBuilder private constructor(
|
||||
}
|
||||
val key = element.key
|
||||
|
||||
container[container.indexOfFirst(firstConstrainSingleIndex) { it is ConstrainSingle<*> && it.key == key }] =
|
||||
element
|
||||
val index = container.indexOfFirst(firstConstrainSingleIndex) { it is ConstrainSingle<*> && it.key == key }
|
||||
if (index != -1) {
|
||||
container[index] = element
|
||||
} else {
|
||||
add(element)
|
||||
}
|
||||
|
||||
return true
|
||||
} else {
|
||||
return container.add(element)
|
||||
|
Loading…
Reference in New Issue
Block a user