Commit adb094f2 authored by ryoii's avatar ryoii

http api support Face

parent e66cfc95
...@@ -389,7 +389,7 @@ Content-Type:multipart/form-data ...@@ -389,7 +389,7 @@ Content-Type:multipart/form-data
+ [x] At,@消息 + [x] At,@消息
+ [x] AtAll,@全体成员 + [x] AtAll,@全体成员
+ [ ] Face,表情消息 + [x] Face,表情消息
+ [x] Plain,文字消息 + [x] Plain,文字消息
+ [x] Image,图片消息 + [x] Image,图片消息
+ [ ] Xml,Xml卡片消息 + [ ] Xml,Xml卡片消息
......
...@@ -13,7 +13,6 @@ import kotlinx.serialization.SerialName ...@@ -13,7 +13,6 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
import net.mamoe.mirai.contact.Contact import net.mamoe.mirai.contact.Contact
import net.mamoe.mirai.contact.Group import net.mamoe.mirai.contact.Group
import net.mamoe.mirai.contact.Member
import net.mamoe.mirai.message.FriendMessage import net.mamoe.mirai.message.FriendMessage
import net.mamoe.mirai.message.GroupMessage import net.mamoe.mirai.message.GroupMessage
import net.mamoe.mirai.message.MessagePacket import net.mamoe.mirai.message.MessagePacket
...@@ -80,7 +79,7 @@ sealed class MessageDTO : DTO ...@@ -80,7 +79,7 @@ sealed class MessageDTO : DTO
/* /*
Extend function Extend function
*/ */
suspend fun MessagePacket<*, *>.toDTO(): MessagePacketDTO = when (this) { fun MessagePacket<*, *>.toDTO(): MessagePacketDTO = when (this) {
is FriendMessage -> FriendMessagePacketDTO(QQDTO(sender)) is FriendMessage -> FriendMessagePacketDTO(QQDTO(sender))
is GroupMessage -> GroupMessagePacketDTO(MemberDTO(sender)) is GroupMessage -> GroupMessagePacketDTO(MemberDTO(sender))
else -> UnKnownMessagePacketDTO("UnKnown Message Packet") else -> UnKnownMessagePacketDTO("UnKnown Message Packet")
...@@ -94,7 +93,7 @@ fun Message.toDTO() = when (this) { ...@@ -94,7 +93,7 @@ fun Message.toDTO() = when (this) {
is MessageSource -> MessageSourceDTO(messageUid) is MessageSource -> MessageSourceDTO(messageUid)
is At -> AtDTO(target, display) is At -> AtDTO(target, display)
is AtAll -> AtAllDTO(0L) is AtAll -> AtAllDTO(0L)
is Face -> FaceDTO(id.value.toInt()) is Face -> FaceDTO(id)
is PlainText -> PlainDTO(stringValue) is PlainText -> PlainDTO(stringValue)
is Image -> ImageDTO(imageId) is Image -> ImageDTO(imageId)
is XMLMessage -> XmlDTO(stringValue) is XMLMessage -> XmlDTO(stringValue)
...@@ -105,7 +104,7 @@ fun Message.toDTO() = when (this) { ...@@ -105,7 +104,7 @@ fun Message.toDTO() = when (this) {
fun MessageDTO.toMessage(contact: Contact) = when (this) { fun MessageDTO.toMessage(contact: Contact) = when (this) {
is AtDTO -> At((contact as Group)[target]) is AtDTO -> At((contact as Group)[target])
is AtAllDTO -> AtAll is AtAllDTO -> AtAll
is FaceDTO -> Face(FaceId(faceId.toUByte())) is FaceDTO -> Face(faceId)
is PlainDTO -> PlainText(text) is PlainDTO -> PlainText(text)
is ImageDTO -> Image(imageId) is ImageDTO -> Image(imageId)
is XmlDTO -> XMLMessage(xml) is XmlDTO -> XMLMessage(xml)
......
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