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
b9b26b2a
Commit
b9b26b2a
authored
Jan 17, 2020
by
jiahua.liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Message Improvements
parent
fea268d3
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
30 additions
and
0 deletions
+30
-0
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/At.kt
.../src/commonMain/kotlin/net.mamoe.mirai/message/data/At.kt
+4
-0
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/Face.kt
...rc/commonMain/kotlin/net.mamoe.mirai/message/data/Face.kt
+4
-0
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/Image.kt
...c/commonMain/kotlin/net.mamoe.mirai/message/data/Image.kt
+4
-0
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/Message.kt
...commonMain/kotlin/net.mamoe.mirai/message/data/Message.kt
+2
-0
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/MessageChain.kt
...nMain/kotlin/net.mamoe.mirai/message/data/MessageChain.kt
+5
-0
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/PlainText.kt
...mmonMain/kotlin/net.mamoe.mirai/message/data/PlainText.kt
+7
-0
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/XML.kt
...src/commonMain/kotlin/net.mamoe.mirai/message/data/XML.kt
+4
-0
No files found.
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/At.kt
View file @
b9b26b2a
...
@@ -14,6 +14,10 @@ inline class At(val target: Long) : Message {
...
@@ -14,6 +14,10 @@ inline class At(val target: Long) : Message {
override
fun
toString
():
String
=
"[@$target]"
// TODO: 2019/11/25 使用群名称进行 at. 因为手机端只会显示这个文字
override
fun
toString
():
String
=
"[@$target]"
// TODO: 2019/11/25 使用群名称进行 at. 因为手机端只会显示这个文字
companion
object
Key
:
Message
.
Key
<
At
>
companion
object
Key
:
Message
.
Key
<
At
>
override
fun
eq
(
other
:
Message
):
Boolean
{
return
other
is
At
&&
other
.
target
==
this
.
target
}
}
}
/**
/**
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/Face.kt
View file @
b9b26b2a
...
@@ -9,6 +9,10 @@ inline class Face(val id: FaceId) : Message {
...
@@ -9,6 +9,10 @@ inline class Face(val id: FaceId) : Message {
override
fun
toString
():
String
=
"[face${id.value}]"
override
fun
toString
():
String
=
"[face${id.value}]"
companion
object
Key
:
Message
.
Key
<
Face
>
companion
object
Key
:
Message
.
Key
<
Face
>
override
fun
eq
(
other
:
Message
):
Boolean
{
return
other
is
Face
&&
other
.
id
==
this
.
id
}
}
}
/**
/**
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/Image.kt
View file @
b9b26b2a
...
@@ -19,6 +19,10 @@ inline class Image(inline val id: ImageId) : Message {
...
@@ -19,6 +19,10 @@ inline class Image(inline val id: ImageId) : Message {
override
fun
toString
():
String
=
"[${id.value}]"
override
fun
toString
():
String
=
"[${id.value}]"
companion
object
Key
:
Message
.
Key
<
Image
>
companion
object
Key
:
Message
.
Key
<
Image
>
override
fun
eq
(
other
:
Message
):
Boolean
{
return
other
is
Image
&&
other
.
id
==
this
.
id
}
}
}
inline
val
Image
.
idValue
:
String
get
()
=
id
.
value
inline
val
Image
.
idValue
:
String
get
()
=
id
.
value
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/Message.kt
View file @
b9b26b2a
...
@@ -97,6 +97,8 @@ interface Message {
...
@@ -97,6 +97,8 @@ interface Message {
operator
fun
plus
(
another
:
Float
):
MessageChain
=
this
.
followedBy
(
another
.
toString
().
toMessage
())
operator
fun
plus
(
another
:
Float
):
MessageChain
=
this
.
followedBy
(
another
.
toString
().
toMessage
())
operator
fun
plus
(
another
:
Number
):
MessageChain
=
this
.
followedBy
(
another
.
toString
().
toMessage
())
operator
fun
plus
(
another
:
Number
):
MessageChain
=
this
.
followedBy
(
another
.
toString
().
toMessage
())
}
}
/**
/**
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/MessageChain.kt
View file @
b9b26b2a
...
@@ -41,6 +41,11 @@ interface MessageChain : Message, MutableList<Message> {
...
@@ -41,6 +41,11 @@ interface MessageChain : Message, MutableList<Message> {
*/
*/
operator
fun
<
M
:
Message
>
get
(
key
:
Message
.
Key
<
M
>):
M
=
first
(
key
)
operator
fun
<
M
:
Message
>
get
(
key
:
Message
.
Key
<
M
>):
M
=
first
(
key
)
override
fun
eq
(
other
:
Message
):
Boolean
{
if
(
other
is
MessageChain
&&
other
.
size
!=
this
.
size
)
return
false
return
this
.
toString
()
==
other
.
toString
()
}
}
}
/**
/**
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/PlainText.kt
View file @
b9b26b2a
...
@@ -6,6 +6,13 @@ inline class PlainText(val stringValue: String) : Message {
...
@@ -6,6 +6,13 @@ inline class PlainText(val stringValue: String) : Message {
override
fun
toString
():
String
=
stringValue
override
fun
toString
():
String
=
stringValue
companion
object
Key
:
Message
.
Key
<
PlainText
>
companion
object
Key
:
Message
.
Key
<
PlainText
>
override
fun
eq
(
other
:
Message
):
Boolean
{
if
(
other
is
MessageChain
){
return
other
eq
this
.
toString
()
}
return
other
is
PlainText
&&
other
.
stringValue
==
this
.
stringValue
}
}
}
/**
/**
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/XML.kt
View file @
b9b26b2a
...
@@ -11,6 +11,10 @@ inline class XMLMessage(val stringValue: String) : Message,
...
@@ -11,6 +11,10 @@ inline class XMLMessage(val stringValue: String) : Message,
SingleOnly
{
SingleOnly
{
override
fun
followedBy
(
tail
:
Message
):
Nothing
=
error
(
"XMLMessage Message cannot be followed"
)
override
fun
followedBy
(
tail
:
Message
):
Nothing
=
error
(
"XMLMessage Message cannot be followed"
)
override
fun
toString
():
String
=
stringValue
override
fun
toString
():
String
=
stringValue
override
fun
eq
(
other
:
Message
):
Boolean
{
return
other
is
XMLMessage
&&
other
.
stringValue
==
this
.
stringValue
}
}
}
/**
/**
...
...
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