diff --git a/docs/Messages.md b/docs/Messages.md new file mode 100644 index 000000000..f25d0eecf --- /dev/null +++ b/docs/Messages.md @@ -0,0 +1,11 @@ +# Mirai - Messages + +## 消息系统 + +在 Contacts 章节提到,要发送消息,使用 `Contact.sendMessage(Message)`。 + +[![](https://mermaid.ink/img/eyJjb2RlIjoiY2xhc3NEaWFncmFtXG5cbmNsYXNzIE1lc3NhZ2VDaGFpblxuTWVzc2FnZUNoYWluIDogTGlzdH5TaW5nbGVNZXNzYWdlflxuXG5NZXNzYWdlPHwtLU1lc3NhZ2VDaGFpblxuTWVzc2FnZTx8LS1TaW5nbGVNZXNzYWdlXG5cbk1lc3NhZ2VDaGFpbiBvLS0gU2luZ2xlTWVzc2FnZVxuXG5TaW5nbGVNZXNzYWdlPHwtLU1lc3NhZ2VDb250ZW50XG5TaW5nbGVNZXNzYWdlPHwtLU1lc3NhZ2VNZXRhZGF0YVxuXG4iLCJtZXJtYWlkIjp7InRoZW1lIjoiZGVmYXVsdCJ9LCJ1cGRhdGVFZGl0b3IiOmZhbHNlfQ)](https://mermaid-js.github.io/mermaid-live-editor/#/edit/eyJjb2RlIjoiY2xhc3NEaWFncmFtXG5cbmNsYXNzIE1lc3NhZ2VDaGFpblxuTWVzc2FnZUNoYWluIDogTGlzdH5TaW5nbGVNZXNzYWdlflxuXG5NZXNzYWdlPHwtLU1lc3NhZ2VDaGFpblxuTWVzc2FnZTx8LS1TaW5nbGVNZXNzYWdlXG5cbk1lc3NhZ2VDaGFpbiBvLS0gU2luZ2xlTWVzc2FnZVxuXG5TaW5nbGVNZXNzYWdlPHwtLU1lc3NhZ2VDb250ZW50XG5TaW5nbGVNZXNzYWdlPHwtLU1lc3NhZ2VNZXRhZGF0YVxuXG4iLCJtZXJtYWlkIjp7InRoZW1lIjoiZGVmYXVsdCJ9LCJ1cGRhdGVFZGl0b3IiOmZhbHNlfQ) + +`SingleMessage` 表示单个消息元素,`MessageChain`(消息链) 是 `List`。主动发送的消息和从服务器接收消息都是 `MessageChain`。 + +mirai 提供大量消息链的扩展:[MessageChain.kt](../mirai-core-api/src/commonMain/kotlin/message/data/MessageChain.kt#L59)。 \ No newline at end of file diff --git a/docs/src/Contacts.mermaid.md b/docs/src/Contacts.mermaid.md index 513fcd7cc..8dc40a7b9 100644 --- a/docs/src/Contacts.mermaid.md +++ b/docs/src/Contacts.mermaid.md @@ -57,18 +57,18 @@ class Member { +group: Group } -ContactOrBot<--Contact -ContactOrBot<--UserOrBot +ContactOrBot<|--Contact +ContactOrBot<|--UserOrBot -UserOrBot<--Bot -UserOrBot<--User +UserOrBot<|--Bot +UserOrBot<|--User -Contact<--User -Contact<--Group +Contact<|--User +Contact<|--Group -User<--Member -User<--Friend +User<|--Member +User<|--Friend -Member<--NormalMember -Member<--AnonymousMember +Member<|--NormalMember +Member<|--AnonymousMember ``` \ No newline at end of file diff --git a/docs/src/Messages.mermaid.md b/docs/src/Messages.mermaid.md new file mode 100644 index 000000000..63d1a500e --- /dev/null +++ b/docs/src/Messages.mermaid.md @@ -0,0 +1,47 @@ +```mermaid +classDiagram + +class MessageChain +MessageChain : List~SingleMessage~ + +Message<|--MessageChain +Message<|--SingleMessage + +MessageChain o-- SingleMessage + +SingleMessage<|--MessageContent +SingleMessage<|--MessageMetadata + + +%%% + + +MessageMetadata<|--QuoteReply +MessageMetadata<|--MessageSource + + +%% + +MessageSource<|--OnlineMessageSource +MessageSource<|--OfflineMessageSource + +MessageContent<|--PlainText +MessageContent<|--Image +MessageContent<|--At +MessageContent<|--AtAll +MessageContent<|--Face +MessageContent<|--ForwardMessage + +MessageContent<|--HummerMessage +HummerMessage<|--PokeMessage +HummerMessage<|--VipFace +HummerMessage<|--FlashImage + +MessageContent<|--RichMessage +RichMessage<|--ServiceMessage +RichMessage<|--LightApp + + +MessageContent<|--PttMessage +PttMessage<|--Voice +``` \ No newline at end of file