Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Mirai
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Mirai
Commits
dc55dbb4
Commit
dc55dbb4
authored
Feb 14, 2020
by
Him188
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
4738de33
1b3b543c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
1 deletion
+20
-1
mirai-api-http/README_CH.md
mirai-api-http/README_CH.md
+14
-1
mirai-api-http/src/main/kotlin/net/mamoe/mirai/api/http/data/common/MessageDTO.kt
...kotlin/net/mamoe/mirai/api/http/data/common/MessageDTO.kt
+5
-0
mirai-api-http/src/main/kotlin/net/mamoe/mirai/api/http/util/Json.kt
...ttp/src/main/kotlin/net/mamoe/mirai/api/http/util/Json.kt
+1
-0
No files found.
mirai-api-http/README_CH.md
View file @
dc55dbb4
...
...
@@ -343,9 +343,10 @@ Content-Type:multipart/form-data
#### 消息是构成消息链的基本对象,目前支持的消息类型有
+
[x] At,@消息
+
[x] AtAll,@全体成员
+
[x] Face,表情消息
+
[x] Plain,文字消息
+
[
] Image,图片消息
+
[
x
] Image,图片消息
+
[ ] Xml,Xml卡片消息
+
[ ] 敬请期待
...
...
@@ -364,6 +365,18 @@ Content-Type:multipart/form-data
| target | Long | 群员QQ号 |
| display | String | @时显示的文本如:"@Mirai" |
#### AtAll
```
json5
{
"type": "AtAll"
}
```
| 名字 | 类型 | 说明 |
| ------- | ------ | ------------------------- |
| - | - | - |
#### Face
```
json5
...
...
mirai-api-http/src/main/kotlin/net/mamoe/mirai/api/http/data/common/MessageDTO.kt
View file @
dc55dbb4
...
...
@@ -39,6 +39,9 @@ data class UnKnownMessagePacketDTO(val msg: String) : MessagePacketDTO()
@SerialName
(
"At"
)
data class
AtDTO
(
val
target
:
Long
,
val
display
:
String
)
:
MessageDTO
()
@Serializable
@SerialName
(
"AtAll"
)
data class
AtAllDTO
(
val
target
:
Long
=
0
)
:
MessageDTO
()
// target为保留字段
@Serializable
@SerialName
(
"Face"
)
data class
FaceDTO
(
val
faceId
:
Int
)
:
MessageDTO
()
@Serializable
...
...
@@ -83,6 +86,7 @@ fun MessageChainDTO.toMessageChain() =
@UseExperimental
(
ExperimentalUnsignedTypes
::
class
)
fun
Message
.
toDTO
()
=
when
(
this
)
{
is
At
->
AtDTO
(
target
,
display
)
is
AtAll
->
AtAllDTO
(
0L
)
is
Face
->
FaceDTO
(
id
.
value
.
toInt
())
is
PlainText
->
PlainDTO
(
stringValue
)
is
Image
->
ImageDTO
(
imageId
)
...
...
@@ -93,6 +97,7 @@ fun Message.toDTO() = when (this) {
@UseExperimental
(
ExperimentalUnsignedTypes
::
class
,
MiraiInternalAPI
::
class
)
fun
MessageDTO
.
toMessage
()
=
when
(
this
)
{
is
AtDTO
->
At
(
target
,
display
)
is
AtAllDTO
->
AtAll
is
FaceDTO
->
Face
(
FaceId
(
faceId
.
toUByte
()))
is
PlainDTO
->
PlainText
(
text
)
is
ImageDTO
->
Image
(
imageId
)
...
...
mirai-api-http/src/main/kotlin/net/mamoe/mirai/api/http/util/Json.kt
View file @
dc55dbb4
...
...
@@ -51,6 +51,7 @@ object MiraiJson {
}
polymorphic
(
MessageDTO
.
serializer
())
{
AtDTO
::
class
with
AtDTO
.
serializer
()
AtAllDTO
::
class
with
AtAllDTO
.
serializer
()
FaceDTO
::
class
with
FaceDTO
.
serializer
()
PlainDTO
::
class
with
PlainDTO
.
serializer
()
ImageDTO
::
class
with
ImageDTO
.
serializer
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment