Fix message logging

This commit is contained in:
Karlatemp 2021-11-06 19:05:59 +08:00
parent 3644ff0035
commit 8870558d4c
No known key found for this signature in database
GPG Key ID: 21FBDDF664FF06F8
2 changed files with 8 additions and 4 deletions

View File

@ -250,8 +250,10 @@ internal suspend fun <C : User> SendMessageHandler<out C>.sendMessageImpl(
val result = this
.runCatching { sendMessage(message, chain, SendMessageStep.FIRST) }
// logMessageSent(result.getOrNull()?.source?.plus(chain) ?: chain) // log with source
contact.logMessageSent(chain)
if (result.isSuccess) {
// logMessageSent(result.getOrNull()?.source?.plus(chain) ?: chain) // log with source
contact.logMessageSent(chain)
}
postSendEventConstructor(contact, chain, result.exceptionOrNull(), result.getOrNull()).broadcast()

View File

@ -162,8 +162,10 @@ internal class GroupImpl constructor(
val result = GroupSendMessageHandler(this)
.runCatching { sendMessage(message, chain, SendMessageStep.FIRST) }
// logMessageSent(result.getOrNull()?.source?.plus(chain) ?: chain) // log with source
logMessageSent(chain)
if (result.isSuccess) {
// logMessageSent(result.getOrNull()?.source?.plus(chain) ?: chain) // log with source
logMessageSent(chain)
}
GroupMessagePostSendEvent(this, chain, result.exceptionOrNull(), result.getOrNull()).broadcast()