mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-31 19:40:24 +08:00
Add logging for uninitialized botAsMember
on creating new GroupImpl instance. helps #1776
This commit is contained in:
parent
7d3971259d
commit
4a32f03797
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2019-2021 Mamoe Technologies and contributors.
|
||||
* Copyright 2019-2022 Mamoe Technologies and contributors.
|
||||
*
|
||||
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
||||
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
|
||||
@ -90,9 +90,26 @@ internal fun GroupImpl(
|
||||
this@Group.members.delegate.add(member)
|
||||
}
|
||||
}
|
||||
}.apply {
|
||||
if (!botAsMemberInitialized) {
|
||||
logger.error(
|
||||
contextualBugReportException("GroupImpl", """
|
||||
groupId: ${groupInfo.groupCode.takeIf { it != 0L } ?: id}
|
||||
groupUin: ${groupInfo.uin}
|
||||
membersCount: ${members.count()}
|
||||
botId: ${bot.id}
|
||||
owner: ${kotlin.runCatching { owner }.getOrNull()?.id}
|
||||
""".trimIndent(), additional = "并告知此时 Bot 是否为群管理员或群主, 和是否刚刚加入或离开这个群"
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val logger by lazy {
|
||||
MiraiLogger.Factory.create(GroupImpl::class.java, "Group")
|
||||
}
|
||||
|
||||
@Suppress("PropertyName")
|
||||
internal class GroupImpl constructor(
|
||||
bot: QQAndroidBot,
|
||||
@ -109,6 +126,7 @@ internal class GroupImpl constructor(
|
||||
|
||||
override lateinit var owner: NormalMemberImpl
|
||||
override lateinit var botAsMember: NormalMemberImpl
|
||||
internal val botAsMemberInitialized = ::botAsMember.isInitialized
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
@Deprecated("Please use files instead.", replaceWith = ReplaceWith("files.root"), level = DeprecationLevel.WARNING)
|
||||
|
Loading…
Reference in New Issue
Block a user