Update docs

This commit is contained in:
Him188 2020-12-19 22:01:50 +08:00
parent 9a0c79705e
commit ed81ac4351
3 changed files with 68 additions and 10 deletions

11
docs/Messages.md Normal file
View File

@ -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<SingleMessage>`。主动发送的消息和从服务器接收消息都是 `MessageChain`
mirai 提供大量消息链的扩展:[MessageChain.kt](../mirai-core-api/src/commonMain/kotlin/message/data/MessageChain.kt#L59)。

View File

@ -57,18 +57,18 @@ class Member {
+group: Group +group: Group
} }
ContactOrBot<--Contact ContactOrBot<|--Contact
ContactOrBot<--UserOrBot ContactOrBot<|--UserOrBot
UserOrBot<--Bot UserOrBot<|--Bot
UserOrBot<--User UserOrBot<|--User
Contact<--User Contact<|--User
Contact<--Group Contact<|--Group
User<--Member User<|--Member
User<--Friend User<|--Friend
Member<--NormalMember Member<|--NormalMember
Member<--AnonymousMember Member<|--AnonymousMember
``` ```

View File

@ -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
```