diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/BotAccount.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/BotAccount.kt index 01e2c741c..4a453234c 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/BotAccount.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/BotAccount.kt @@ -26,6 +26,24 @@ data class BotAccount( val passwordMd5: ByteArray // md5 ) { constructor(id: Long, passwordPlainText: String) : this(id, md5(passwordPlainText.toByteArray())) + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other == null || this::class != other::class) return false + + other as BotAccount + + if (id != other.id) return false + if (!passwordMd5.contentEquals(other.passwordMd5)) return false + + return true + } + + override fun hashCode(): Int { + var result = id.hashCode() + result = 31 * result + passwordMd5.contentHashCode() + return result + } } /**