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
c6a2229f
Commit
c6a2229f
authored
Feb 14, 2020
by
ryoii
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
http-api support AtAll
parent
afb74ec6
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 @
c6a2229f
...
@@ -343,9 +343,10 @@ Content-Type:multipart/form-data
...
@@ -343,9 +343,10 @@ Content-Type:multipart/form-data
#### 消息是构成消息链的基本对象,目前支持的消息类型有
#### 消息是构成消息链的基本对象,目前支持的消息类型有
+
[x] At,@消息
+
[x] At,@消息
+
[x] AtAll,@全体成员
+
[x] Face,表情消息
+
[x] Face,表情消息
+
[x] Plain,文字消息
+
[x] Plain,文字消息
+
[
] Image,图片消息
+
[
x
] Image,图片消息
+
[ ] Xml,Xml卡片消息
+
[ ] Xml,Xml卡片消息
+
[ ] 敬请期待
+
[ ] 敬请期待
...
@@ -364,6 +365,18 @@ Content-Type:multipart/form-data
...
@@ -364,6 +365,18 @@ Content-Type:multipart/form-data
| target | Long | 群员QQ号 |
| target | Long | 群员QQ号 |
| display | String | @时显示的文本如:"@Mirai" |
| display | String | @时显示的文本如:"@Mirai" |
#### AtAll
```
json5
{
"type": "AtAll"
}
```
| 名字 | 类型 | 说明 |
| ------- | ------ | ------------------------- |
| - | - | - |
#### Face
#### Face
```
json5
```
json5
...
...
mirai-api-http/src/main/kotlin/net/mamoe/mirai/api/http/data/common/MessageDTO.kt
View file @
c6a2229f
...
@@ -39,6 +39,9 @@ data class UnKnownMessagePacketDTO(val msg: String) : MessagePacketDTO()
...
@@ -39,6 +39,9 @@ data class UnKnownMessagePacketDTO(val msg: String) : MessagePacketDTO()
@SerialName
(
"At"
)
@SerialName
(
"At"
)
data class
AtDTO
(
val
target
:
Long
,
val
display
:
String
)
:
MessageDTO
()
data class
AtDTO
(
val
target
:
Long
,
val
display
:
String
)
:
MessageDTO
()
@Serializable
@Serializable
@SerialName
(
"AtAll"
)
data class
AtAllDTO
(
val
target
:
Long
=
0
)
:
MessageDTO
()
// target为保留字段
@Serializable
@SerialName
(
"Face"
)
@SerialName
(
"Face"
)
data class
FaceDTO
(
val
faceId
:
Int
)
:
MessageDTO
()
data class
FaceDTO
(
val
faceId
:
Int
)
:
MessageDTO
()
@Serializable
@Serializable
...
@@ -83,6 +86,7 @@ fun MessageChainDTO.toMessageChain() =
...
@@ -83,6 +86,7 @@ fun MessageChainDTO.toMessageChain() =
@UseExperimental
(
ExperimentalUnsignedTypes
::
class
)
@UseExperimental
(
ExperimentalUnsignedTypes
::
class
)
fun
Message
.
toDTO
()
=
when
(
this
)
{
fun
Message
.
toDTO
()
=
when
(
this
)
{
is
At
->
AtDTO
(
target
,
display
)
is
At
->
AtDTO
(
target
,
display
)
is
AtAll
->
AtAllDTO
(
0L
)
is
Face
->
FaceDTO
(
id
.
value
.
toInt
())
is
Face
->
FaceDTO
(
id
.
value
.
toInt
())
is
PlainText
->
PlainDTO
(
stringValue
)
is
PlainText
->
PlainDTO
(
stringValue
)
is
Image
->
ImageDTO
(
imageId
)
is
Image
->
ImageDTO
(
imageId
)
...
@@ -93,6 +97,7 @@ fun Message.toDTO() = when (this) {
...
@@ -93,6 +97,7 @@ fun Message.toDTO() = when (this) {
@UseExperimental
(
ExperimentalUnsignedTypes
::
class
,
MiraiInternalAPI
::
class
)
@UseExperimental
(
ExperimentalUnsignedTypes
::
class
,
MiraiInternalAPI
::
class
)
fun
MessageDTO
.
toMessage
()
=
when
(
this
)
{
fun
MessageDTO
.
toMessage
()
=
when
(
this
)
{
is
AtDTO
->
At
(
target
,
display
)
is
AtDTO
->
At
(
target
,
display
)
is
AtAllDTO
->
AtAll
is
FaceDTO
->
Face
(
FaceId
(
faceId
.
toUByte
()))
is
FaceDTO
->
Face
(
FaceId
(
faceId
.
toUByte
()))
is
PlainDTO
->
PlainText
(
text
)
is
PlainDTO
->
PlainText
(
text
)
is
ImageDTO
->
Image
(
imageId
)
is
ImageDTO
->
Image
(
imageId
)
...
...
mirai-api-http/src/main/kotlin/net/mamoe/mirai/api/http/util/Json.kt
View file @
c6a2229f
...
@@ -51,6 +51,7 @@ object MiraiJson {
...
@@ -51,6 +51,7 @@ object MiraiJson {
}
}
polymorphic
(
MessageDTO
.
serializer
())
{
polymorphic
(
MessageDTO
.
serializer
())
{
AtDTO
::
class
with
AtDTO
.
serializer
()
AtDTO
::
class
with
AtDTO
.
serializer
()
AtAllDTO
::
class
with
AtAllDTO
.
serializer
()
FaceDTO
::
class
with
FaceDTO
.
serializer
()
FaceDTO
::
class
with
FaceDTO
.
serializer
()
PlainDTO
::
class
with
PlainDTO
.
serializer
()
PlainDTO
::
class
with
PlainDTO
.
serializer
()
ImageDTO
::
class
with
ImageDTO
.
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