Commit 3c83883c authored by Him188's avatar Him188

Add space automatically if necessary

parent b991c6ef
...@@ -92,7 +92,7 @@ abstract class MessagePacketBase<TSender : QQ, TSubject : Contact>(_bot: Bot) : ...@@ -92,7 +92,7 @@ abstract class MessagePacketBase<TSender : QQ, TSubject : Contact>(_bot: Bot) :
// region // region
/** /**
* 引用这个消息. * 引用这个消息. 当且仅当消息为群消息时可用. 否则将会抛出 [IllegalArgumentException]
*/ */
inline fun MessageChain.quote(): MessageChain = this.quote(sender as? Member ?: error("only group message can be quoted")) inline fun MessageChain.quote(): MessageChain = this.quote(sender as? Member ?: error("only group message can be quoted"))
......
...@@ -30,6 +30,15 @@ class At @MiraiInternalAPI constructor(val target: Long, val display: String) : ...@@ -30,6 +30,15 @@ class At @MiraiInternalAPI constructor(val target: Long, val display: String) :
override fun eq(other: Message): Boolean { override fun eq(other: Message): Boolean {
return other is At && other.target == this.target return other is At && other.target == this.target
} }
// 自动为消息补充 " "
override fun followedBy(tail: Message): MessageChain {
if(tail is PlainText && !tail.stringValue.startsWith(' ')){
return super.followedBy(PlainText(" ")) + tail
}
return super.followedBy(tail)
}
} }
/** /**
......
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