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
86aacc5d
Commit
86aacc5d
authored
Apr 25, 2020
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add `Message.isContentEmpty`
parent
48362a24
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/Message.kt
...commonMain/kotlin/net.mamoe.mirai/message/data/Message.kt
+12
-0
No files found.
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/Message.kt
View file @
86aacc5d
...
@@ -57,6 +57,11 @@ import kotlin.jvm.JvmSynthetic
...
@@ -57,6 +57,11 @@ import kotlin.jvm.JvmSynthetic
* #### 实现规范
* #### 实现规范
* 除 [MessageChain] 外, 所有 [Message] 的实现类都有伴生对象实现 [Key] 接口.
* 除 [MessageChain] 外, 所有 [Message] 的实现类都有伴生对象实现 [Key] 接口.
*
*
* #### [CharSequence] 继承
* 所有 [CharSequence] 的行为均由 [toString] 委托.
*
* 即, `appendable.append(message)` 相当于 `appendable.append(message.toString())`
*
* @see PlainText 纯文本
* @see PlainText 纯文本
* @see Image 图片
* @see Image 图片
* @see Face 原生表情
* @see Face 原生表情
...
@@ -261,6 +266,13 @@ interface Message { // must be interface. Don't consider any changes.
...
@@ -261,6 +266,13 @@ interface Message { // must be interface. Don't consider any changes.
this
.
followedByInternalForBinaryCompatibility
(
another
.
toString
().
toMessage
())
this
.
followedByInternalForBinaryCompatibility
(
another
.
toString
().
toMessage
())
}
}
@SinceMirai
(
"0.39.3"
)
fun
Message
.
isContentEmpty
():
Boolean
=
when
(
this
)
{
is
PlainText
->
this
.
isEmpty
()
is
MessageChain
->
this
.
any
{
it
.
isContentEmpty
()
}
else
->
false
}
inline
fun
Message
.
isPlain
():
Boolean
=
this
is
PlainText
inline
fun
Message
.
isPlain
():
Boolean
=
this
is
PlainText
inline
fun
Message
.
isNotPlain
():
Boolean
=
this
!
is
PlainText
inline
fun
Message
.
isNotPlain
():
Boolean
=
this
!
is
PlainText
...
...
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