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
4c9532ba
Commit
4c9532ba
authored
Jun 07, 2020
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update docs
parent
9fd24683
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
15 deletions
+13
-15
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/Message.kt
...commonMain/kotlin/net.mamoe.mirai/message/data/Message.kt
+11
-13
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/MessageChain.kt
...nMain/kotlin/net.mamoe.mirai/message/data/MessageChain.kt
+2
-2
No files found.
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/Message.kt
View file @
4c9532ba
...
...
@@ -107,6 +107,8 @@ interface Message { // must be interface. Don't consider any changes.
* println(c) // "Hello world!"
* ```
*
* 在 Java 使用 [plus]
*
* @see plus `+` 操作符重载
*/
@JvmSynthetic
// in java they should use `plus` instead
...
...
@@ -118,11 +120,11 @@ interface Message { // must be interface. Don't consider any changes.
* 在使用消息相关 DSL 和扩展时, 一些内容比较的实现均使用的是 [contentToString] 而不是 [toString]
*
* 各个 [SingleMessage] 的转换示例:
* - [PlainText]
: "Hello"
* - [GroupImage]
: "[mirai:image:{01E9451B-70ED-EAE3-B37C-101F1EEBF5B5}.mirai]"
* - [FriendImage]
: "[mirai:image:/f8f1ab55-bf8e-4236-b55e-955848d7069f]"
* - [PokeMessage]
: "[mirai:poke:1,-1]"
* - [MessageChain]: 无间隔地连接所有元素 (`joinToString("")`)
* - [PlainText]
: `"Hello"`
* - [GroupImage]
: `"[mirai:image:{01E9451B-70ED-EAE3-B37C-101F1EEBF5B5}.mirai]"`
* - [FriendImage]
: `"[mirai:image:/f8f1ab55-bf8e-4236-b55e-955848d7069f]"`
* - [PokeMessage]
: `"[mirai:poke:1,-1]"`
* - [MessageChain]
: 无间隔地连接所有元素 (`joinToString("")`)
* - ...
*
* @see contentToString 转为最接近官方格式的字符串
...
...
@@ -135,10 +137,10 @@ interface Message { // must be interface. Don't consider any changes.
* 在使用消息相关 DSL 和扩展时, 一些内容比较的实现均使用 [contentToString] 而不是 [toString]
*
* 各个 [SingleMessage] 的转换示例:
* - [PlainText]
: "Hello"
* - [Image]
: "\[图片\]"
* - [PokeMessage]
: "\[戳一戳\]"
* - [MessageChain]: 无间隔地连接所有元素 (`joinToString("", transformer=Message::contentToString)`)
* - [PlainText]
: `"Hello"`
* - [Image]
: `"[图片]"`
* - [PokeMessage]
: `"[戳一戳]"`
* - [MessageChain]
: 无间隔地连接所有元素 (`joinToString("", transformer=Message::contentToString)`)
* - ...
*
* @see toString 得到包含 mirai 消息元素代码的, 易读的字符串
...
...
@@ -152,8 +154,6 @@ interface Message { // must be interface. Don't consider any changes.
* 若本函数返回 `true`, 则表明:
* - `this` 与 [another] 的 [contentToString] 相等
* - `this` 为 [another] 的所有 [MessageContent] 都 [相等][Message.equals] 且有同样的排列顺序.
*
* @sample net.mamoe.mirai.message.data.ContentEqualsTest
*/
/* final */
fun
contentEquals
(
another
:
Message
,
ignoreCase
:
Boolean
=
false
):
Boolean
=
contentEqualsImpl
(
another
,
ignoreCase
)
...
...
@@ -164,8 +164,6 @@ interface Message { // must be interface. Don't consider any changes.
* 若本函数返回 `true`, 则表明:
* - [contentToString] 与 [another] 相等
* - 若 `this` 为 [MessageChain], 则只包含 [MessageMetadata] 和 [PlainText]
*
* @sample net.mamoe.mirai.message.data.ContentEqualsTest
*/
/* final */
fun
contentEquals
(
another
:
String
,
ignoreCase
:
Boolean
=
false
):
Boolean
{
if
(!
this
.
contentToString
().
equals
(
another
,
ignoreCase
=
ignoreCase
))
return
false
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/MessageChain.kt
View file @
4c9532ba
...
...
@@ -413,8 +413,8 @@ inline fun Array<out SingleMessage>.flatten(): Sequence<SingleMessage> = this.as
* 扁平化 [Message]
*
* 对于不同类型的接收者(receiver):
* -
`CombinedMessage
(A, B)` 返回 `A <- B`
* - `
MessageChain
(E, F, G)` 返回 `E <- F <- G`
* -
[CombinedMessage]`
(A, B)` 返回 `A <- B`
* - `
[MessageChain]
(E, F, G)` 返回 `E <- F <- G`
* - 其他: 返回 `sequenceOf(this)`
*/
fun
Message
.
flatten
():
Sequence
<
SingleMessage
>
{
...
...
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