Remove Message.eq override

This commit is contained in:
Him188 2020-02-22 15:18:15 +08:00
parent 7a217f6f65
commit 377c5c66a0
6 changed files with 0 additions and 30 deletions

View File

@ -34,10 +34,6 @@ class At @MiraiInternalAPI constructor(val target: Long, val display: String) :
companion object Key : Message.Key<At> companion object Key : Message.Key<At>
override fun eq(other: Message): Boolean {
return other is At && other.target == this.target
}
// 自动为消息补充 " " // 自动为消息补充 " "
override fun followedBy(tail: Message): MessageChain { override fun followedBy(tail: Message): MessageChain {

View File

@ -167,8 +167,4 @@ class Face(val id: Int) : Message {
const val shouqiang: Int = 169 const val shouqiang: Int = 169
const val qingwa: Int = 170 const val qingwa: Int = 170
} }
override fun eq(other: Message): Boolean {
return other is Face && other.id == this.id
}
} }

View File

@ -49,11 +49,6 @@ sealed class Image : Message {
final override fun toString(): String { final override fun toString(): String {
return "[mirai:$imageId]" return "[mirai:$imageId]"
} }
final override fun eq(other: Message): Boolean {
return if (other is Image) return other.imageId == this.imageId
else this.toString() == other.toString()
}
} }
abstract class CustomFace : Image() { abstract class CustomFace : Image() {

View File

@ -57,12 +57,6 @@ interface MessageChain : Message, MutableList<Message> {
* @param key 由各个类型消息的伴生对象持有. [PlainText.Key] * @param key 由各个类型消息的伴生对象持有. [PlainText.Key]
*/ */
operator fun <M : Message> get(key: Message.Key<M>): M = first(key) operator fun <M : Message> get(key: Message.Key<M>): M = first(key)
override fun eq(other: Message): Boolean {
if (other is MessageChain && other.size != this.size)
return false
return this.toString() == other.toString()
}
} }
/** /**

View File

@ -25,13 +25,6 @@ inline class PlainText(val stringValue: String) : Message {
override fun toString(): String = stringValue override fun toString(): String = stringValue
companion object Key : Message.Key<PlainText> companion object Key : Message.Key<PlainText>
override fun eq(other: Message): Boolean {
if (other is MessageChain) {
return other eq this.toString()
}
return other is PlainText && other.stringValue == this.stringValue
}
} }
/** /**

View File

@ -27,10 +27,6 @@ inline class XMLMessage(val stringValue: String) : Message,
SingleOnly { SingleOnly {
override fun followedBy(tail: Message): Nothing = error("XMLMessage Message cannot be followed") override fun followedBy(tail: Message): Nothing = error("XMLMessage Message cannot be followed")
override fun toString(): String = stringValue override fun toString(): String = stringValue
override fun eq(other: Message): Boolean {
return other is XMLMessage && other.stringValue == this.stringValue
}
} }
/** /**