mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-24 15:00:38 +08:00
Remove Message.eq
override
This commit is contained in:
parent
7a217f6f65
commit
377c5c66a0
@ -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 {
|
||||||
|
@ -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
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -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() {
|
||||||
|
@ -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()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user