Re-order parameters of AnnouncementImage

This commit is contained in:
Him188 2021-07-05 15:30:54 +08:00
parent 858766d6b5
commit b239c57679
2 changed files with 6 additions and 6 deletions

View File

@ -24,9 +24,9 @@ import net.mamoe.mirai.utils.MiraiInternalApi
@SerialName(AnnouncementImage.SERIAL_NAME) @SerialName(AnnouncementImage.SERIAL_NAME)
@Serializable @Serializable
public class AnnouncementImage @MiraiInternalApi public constructor( public class AnnouncementImage @MiraiInternalApi public constructor(
public val id: String,
public val height: String, public val height: String,
public val width: String, public val width: String,
public val id: String
) { ) {
// For stability, do not make it `data class`. // For stability, do not make it `data class`.
@ -35,7 +35,7 @@ public class AnnouncementImage @MiraiInternalApi public constructor(
} }
override fun toString(): String { override fun toString(): String {
return "AnnouncementImage(height='$height', width='$width', id='$id')" return "AnnouncementImage(id='$id', height='$height', width='$width')"
} }
override fun equals(other: Any?): Boolean { override fun equals(other: Any?): Boolean {
@ -44,17 +44,17 @@ public class AnnouncementImage @MiraiInternalApi public constructor(
other as AnnouncementImage other as AnnouncementImage
if (id != other.id) return false
if (height != other.height) return false if (height != other.height) return false
if (width != other.width) return false if (width != other.width) return false
if (id != other.id) return false
return true return true
} }
override fun hashCode(): Int { override fun hashCode(): Int {
var result = height.hashCode() var result = id.hashCode()
result = 31 * result + height.hashCode()
result = 31 * result + width.hashCode() result = 31 * result + width.hashCode()
result = 31 * result + id.hashCode()
return result return result
} }
} }

View File

@ -56,7 +56,7 @@ internal class GroupAnnouncementImage @MiraiInternalApi constructor(
@SerialName("w") val width: String, @SerialName("w") val width: String,
@SerialName("id") val id: String @SerialName("id") val id: String
) : JsonStruct { ) : JsonStruct {
fun toPublic(): AnnouncementImage = AnnouncementImage(height, width, id) fun toPublic(): AnnouncementImage = AnnouncementImage(id, height, width)
} }
@Serializable @Serializable