mirror of
https://github.com/mamoe/mirai.git
synced 2025-02-08 22:31:17 +08:00
Make MessageMetadata.contentToString
final
This commit is contained in:
parent
b0089d58d6
commit
f765804ff7
@ -190,8 +190,6 @@ abstract class CustomMessageMetadata : CustomMessage(), MessageMetadata {
|
||||
|
||||
final override fun toString(): String =
|
||||
"[mirai:custom:${getFactory().typeName}:${String(customToString())}]"
|
||||
|
||||
final override fun contentToString(): String = ""
|
||||
}
|
||||
|
||||
|
||||
|
@ -297,7 +297,13 @@ interface SingleMessage : Message {
|
||||
*
|
||||
* @see ConstrainSingle 约束一个 [MessageChain] 中只存在这一种类型的元素
|
||||
*/
|
||||
interface MessageMetadata : SingleMessage
|
||||
interface MessageMetadata : SingleMessage {
|
||||
/**
|
||||
* 返回空字符串
|
||||
*/
|
||||
@Suppress("WRONG_MODIFIER_CONTAINING_DECLARATION")
|
||||
final override fun contentToString(): String = ""
|
||||
}
|
||||
|
||||
/**
|
||||
* 约束一个 [MessageChain] 中只存在这一种类型的元素. 新元素将会替换旧元素, 保持原顺序.
|
||||
|
@ -132,11 +132,6 @@ sealed class MessageSource : Message, MessageMetadata, ConstrainSingle<MessageSo
|
||||
* 返回 `"[mirai:source:$id,$internalId]"`
|
||||
*/
|
||||
final override fun toString(): String = "[mirai:source:$id,$internalId]"
|
||||
|
||||
/**
|
||||
* 返回空字符串, 因 [MessageMetadata] 的约束.
|
||||
*/
|
||||
final override fun contentToString(): String = ""
|
||||
}
|
||||
|
||||
|
||||
|
@ -55,7 +55,6 @@ class QuoteReply(val source: MessageSource) : Message, MessageMetadata, Constrai
|
||||
override val key: Message.Key<QuoteReply> get() = Key
|
||||
|
||||
override fun toString(): String = "[mirai:quote:${source.id},${source.internalId}]"
|
||||
override fun contentToString(): String = ""
|
||||
override fun equals(other: Any?): Boolean = other is QuoteReply && other.source == this.source
|
||||
override fun hashCode(): Int = source.hashCode()
|
||||
}
|
||||
|
@ -26,10 +26,6 @@ internal class TestConstrainSingleMessage : ConstrainSingle<TestConstrainSingleM
|
||||
|
||||
override fun toString(): String = "<TestConstrainSingleMessage#${super.hashCode()}>"
|
||||
|
||||
override fun contentToString(): String {
|
||||
return ""
|
||||
}
|
||||
|
||||
override val key: Message.Key<TestConstrainSingleMessage>
|
||||
get() = Key
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user