Skip to content

Commit 401634e

Browse files
committed
Add a configuration logPreviousMessages
1 parent f4f7e5f commit 401634e

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

mirai-core/src/commonMain/kotlin/net.mamoe.mirai/network/protocol/tim/TIMBotNetworkHandler.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,9 @@ internal class TIMBotNetworkHandler internal constructor(coroutineContext: Corou
226226
return
227227

228228
if (!packet::class.annotations.filterIsInstance<NoLog>().any()) {
229-
bot.logger.verbose("Packet received: $packet")
229+
if ((packet as? BroadcastControllable)?.shouldBroadcast != false) {
230+
bot.logger.verbose("Packet received: $packet")
231+
}
230232
}
231233

232234
when (packet) {

mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/BotConfiguration.kt

+6
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ class BotConfiguration : CoroutineContext.Element {
6262
* 验证码处理器
6363
*/
6464
var captchaSolver: CaptchaSolver = DefaultCaptchaSolver
65+
/**
66+
* 登录完成后几秒会收到好友消息的历史记录,
67+
* 这些历史记录不会触发事件.
68+
* 这个选项为是否把这些记录添加到日志
69+
*/
70+
var logPreviousMessages: Boolean = false
6571

6672
companion object Key : CoroutineContext.Key<BotConfiguration> {
6773
/**

0 commit comments

Comments
 (0)