mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-06 09:00:14 +08:00
Add MessageSource.quote
This commit is contained in:
parent
3f356af620
commit
2b464a287e
@ -14,6 +14,8 @@ package net.mamoe.mirai.message.data
|
||||
* 消息源只用于 [QuoteReply]
|
||||
*
|
||||
* `mirai-core-qqandroid`: `net.mamoe.mirai.qqandroid.message.MessageSourceFromMsg`
|
||||
*
|
||||
* @see MessageSource.quote 引用这条消息, 创建 [MessageChain]
|
||||
*/
|
||||
interface MessageSource : Message {
|
||||
companion object : Message.Key<MessageSource>
|
||||
|
@ -33,4 +33,13 @@ fun MessageChain.quote(sender: Member): MessageChain {
|
||||
return QuoteReply(it) + sender.at() + " " // required
|
||||
}
|
||||
error("cannot find MessageSource")
|
||||
}
|
||||
|
||||
/**
|
||||
* 引用这条消息.
|
||||
* 返回 `[QuoteReply] + [At] + [PlainText]`(必要的结构)
|
||||
*/
|
||||
fun MessageSource.quote(sender: Member): MessageChain {
|
||||
@UseExperimental(MiraiInternalAPI::class)
|
||||
return QuoteReply(this) + sender.at() + " " // required
|
||||
}
|
Loading…
Reference in New Issue
Block a user