mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-19 18:54:43 +08:00
Add space automatically if necessary
This commit is contained in:
parent
b991c6ef0c
commit
3c83883c66
@ -92,7 +92,7 @@ abstract class MessagePacketBase<TSender : QQ, TSubject : Contact>(_bot: Bot) :
|
||||
// region
|
||||
|
||||
/**
|
||||
* 引用这个消息.
|
||||
* 引用这个消息. 当且仅当消息为群消息时可用. 否则将会抛出 [IllegalArgumentException]
|
||||
*/
|
||||
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) :
|
||||
override fun eq(other: Message): Boolean {
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user