Commit 377c5c66 authored by Him188's avatar Him188

Remove `Message.eq` override

parent 7a217f6f
......@@ -34,10 +34,6 @@ class At @MiraiInternalAPI constructor(val target: Long, val display: String) :
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 {
......
......@@ -167,8 +167,4 @@ class Face(val id: Int) : Message {
const val shouqiang: Int = 169
const val qingwa: Int = 170
}
override fun eq(other: Message): Boolean {
return other is Face && other.id == this.id
}
}
\ No newline at end of file
......@@ -49,11 +49,6 @@ sealed class Image : Message {
final override fun toString(): String {
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() {
......
......@@ -57,12 +57,6 @@ interface MessageChain : Message, MutableList<Message> {
* @param key 由各个类型消息的伴生对象持有. 如 [PlainText.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()
}
}
/**
......
......@@ -25,13 +25,6 @@ inline class PlainText(val stringValue: String) : Message {
override fun toString(): String = stringValue
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
}
}
/**
......
......@@ -27,10 +27,6 @@ inline class XMLMessage(val stringValue: String) : Message,
SingleOnly {
override fun followedBy(tail: Message): Nothing = error("XMLMessage Message cannot be followed")
override fun toString(): String = stringValue
override fun eq(other: Message): Boolean {
return other is XMLMessage && other.stringValue == this.stringValue
}
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment