diff --git a/mirai-core-api/compatibility-validation/android/api/android.api b/mirai-core-api/compatibility-validation/android/api/android.api index a8342399e94..39207c8b634 100644 --- a/mirai-core-api/compatibility-validation/android/api/android.api +++ b/mirai-core-api/compatibility-validation/android/api/android.api @@ -4543,6 +4543,7 @@ public final class net/mamoe/mirai/message/data/ImageType : java/lang/Enum { public static final field PNG Lnet/mamoe/mirai/message/data/ImageType; public static final field UNKNOWN Lnet/mamoe/mirai/message/data/ImageType; public final fun getFormatName ()Ljava/lang/String; + public final fun getSecondaryNames ()[Ljava/lang/String; public static final fun match (Ljava/lang/String;)Lnet/mamoe/mirai/message/data/ImageType; public static final fun matchOrNull (Ljava/lang/String;)Lnet/mamoe/mirai/message/data/ImageType; public static fun valueOf (Ljava/lang/String;)Lnet/mamoe/mirai/message/data/ImageType; diff --git a/mirai-core-api/compatibility-validation/jvm/api/jvm.api b/mirai-core-api/compatibility-validation/jvm/api/jvm.api index e1605441d65..fc4ffe3421c 100644 --- a/mirai-core-api/compatibility-validation/jvm/api/jvm.api +++ b/mirai-core-api/compatibility-validation/jvm/api/jvm.api @@ -4543,6 +4543,7 @@ public final class net/mamoe/mirai/message/data/ImageType : java/lang/Enum { public static final field PNG Lnet/mamoe/mirai/message/data/ImageType; public static final field UNKNOWN Lnet/mamoe/mirai/message/data/ImageType; public final fun getFormatName ()Ljava/lang/String; + public final fun getSecondaryNames ()[Ljava/lang/String; public static final fun match (Ljava/lang/String;)Lnet/mamoe/mirai/message/data/ImageType; public static final fun matchOrNull (Ljava/lang/String;)Lnet/mamoe/mirai/message/data/ImageType; public static fun valueOf (Ljava/lang/String;)Lnet/mamoe/mirai/message/data/ImageType; diff --git a/mirai-core-api/src/commonMain/kotlin/message/data/Image.kt b/mirai-core-api/src/commonMain/kotlin/message/data/Image.kt index d8c460a4eff..f39a3362356 100644 --- a/mirai-core-api/src/commonMain/kotlin/message/data/Image.kt +++ b/mirai-core-api/src/commonMain/kotlin/message/data/Image.kt @@ -371,10 +371,11 @@ public enum class ImageType( * @since 2.9.0 */ @MiraiInternalApi public val formatName: String, + @MiraiInternalApi public vararg val secondaryNames: String ) { PNG("png"), BMP("bmp"), - JPG("jpg"), + JPG("jpg", "JPEG", "JPE"), GIF("gif"), //WEBP, //Unsupported by pc client APNG("png"), @@ -391,7 +392,7 @@ public enum class ImageType( @JvmStatic public fun matchOrNull(str: String): ImageType? { val input = str.uppercase() - return IMAGE_TYPE_ENUM_LIST.firstOrNull { it.name == input } + return IMAGE_TYPE_ENUM_LIST.firstOrNull { it.name == input || it.secondaryNames.contains(input) } } } }