mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-23 14:20:24 +08:00
Use system property mirai.unknown.image.type.logging
to enable logging on unknown image type, helps #1111
This commit is contained in:
parent
36742a867f
commit
50e60cc4fe
@ -117,6 +117,8 @@ OnlineFriendImage() {
|
|||||||
* SHARPP: 1004
|
* SHARPP: 1004
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
internal val UNKNOWN_IMAGE_TYPE_PROMPT_ENABLED = systemProp("mirai.unknown.image.type.logging", false)
|
||||||
|
|
||||||
internal fun getImageType(id: Int): String {
|
internal fun getImageType(id: Int): String {
|
||||||
return when (id) {
|
return when (id) {
|
||||||
1000 -> "jpg"
|
1000 -> "jpg"
|
||||||
@ -125,7 +127,15 @@ internal fun getImageType(id: Int): String {
|
|||||||
1005 -> "bmp"
|
1005 -> "bmp"
|
||||||
2000 -> "gif"
|
2000 -> "gif"
|
||||||
2001, 3 -> "png"
|
2001, 3 -> "png"
|
||||||
else -> DEFAULT_FORMAT_NAME
|
else -> {
|
||||||
|
if (UNKNOWN_IMAGE_TYPE_PROMPT_ENABLED) {
|
||||||
|
MiraiLogger.TopLevel.debug(
|
||||||
|
"Unknown image id: $id. Stacktrace:",
|
||||||
|
Exception()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
DEFAULT_FORMAT_NAME
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user