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
|
val key = element.key
|
||||||
|
|
||||||
container[container.indexOfFirst(firstConstrainSingleIndex) { it is ConstrainSingle<*> && it.key == key }] =
|
val index = container.indexOfFirst(firstConstrainSingleIndex) { it is ConstrainSingle<*> && it.key == key }
|
||||||
element
|
if (index != -1) {
|
||||||
|
container[index] = element
|
||||||
|
} else {
|
||||||
|
add(element)
|
||||||
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
return container.add(element)
|
return container.add(element)
|
||||||
|
Loading…
Reference in New Issue
Block a user