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
d365ec5b
Commit
d365ec5b
authored
Feb 13, 2020
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New feature: AtAll
parent
46fc012f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
4 deletions
+47
-4
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/MessageQQA.kt
...in/kotlin/net/mamoe/mirai/qqandroid/message/MessageQQA.kt
+23
-4
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/GroupMessage.kt
...commonMain/kotlin/net.mamoe.mirai/message/GroupMessage.kt
+24
-0
No files found.
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/MessageQQA.kt
View file @
d365ec5b
...
@@ -13,6 +13,7 @@ import kotlinx.io.core.readUInt
...
@@ -13,6 +13,7 @@ import kotlinx.io.core.readUInt
import
net.mamoe.mirai.message.data.*
import
net.mamoe.mirai.message.data.*
import
net.mamoe.mirai.qqandroid.network.protocol.data.proto.ImMsgBody
import
net.mamoe.mirai.qqandroid.network.protocol.data.proto.ImMsgBody
import
net.mamoe.mirai.qqandroid.network.protocol.data.proto.MsgComm
import
net.mamoe.mirai.qqandroid.network.protocol.data.proto.MsgComm
import
net.mamoe.mirai.utils.MiraiDebugAPI
import
net.mamoe.mirai.utils.MiraiInternalAPI
import
net.mamoe.mirai.utils.MiraiInternalAPI
import
net.mamoe.mirai.utils.io.discardExact
import
net.mamoe.mirai.utils.io.discardExact
import
net.mamoe.mirai.utils.io.hexToBytes
import
net.mamoe.mirai.utils.io.hexToBytes
...
@@ -184,6 +185,14 @@ notOnlineImage=NotOnlineImage#2050019814 {
...
@@ -184,6 +185,14 @@ notOnlineImage=NotOnlineImage#2050019814 {
pbReserve=08 01 10 00 32 00 42 0E 5B E5 8A A8 E7 94 BB E8 A1 A8 E6 83 85 5D 50 00 78 05
pbReserve=08 01 10 00 32 00 42 0E 5B E5 8A A8 E7 94 BB E8 A1 A8 E6 83 85 5D 50 00 78 05
}
}
*/
*/
private
val
atAllData
=
ImMsgBody
.
Elem
(
text
=
ImMsgBody
.
Text
(
str
=
"@全体成员"
,
attr6Buf
=
"00 01 00 00 00 05 01 00 00 00 00 00 00"
.
hexToBytes
()
)
)
internal
fun
MessageChain
.
toRichTextElems
():
MutableList
<
ImMsgBody
.
Elem
>
{
internal
fun
MessageChain
.
toRichTextElems
():
MutableList
<
ImMsgBody
.
Elem
>
{
val
elements
=
mutableListOf
<
ImMsgBody
.
Elem
>()
val
elements
=
mutableListOf
<
ImMsgBody
.
Elem
>()
...
@@ -203,6 +212,7 @@ internal fun MessageChain.toRichTextElems(): MutableList<ImMsgBody.Elem> {
...
@@ -203,6 +212,7 @@ internal fun MessageChain.toRichTextElems(): MutableList<ImMsgBody.Elem> {
is
CustomFaceFromServer
->
elements
.
add
(
ImMsgBody
.
Elem
(
customFace
=
it
.
delegate
))
is
CustomFaceFromServer
->
elements
.
add
(
ImMsgBody
.
Elem
(
customFace
=
it
.
delegate
))
is
NotOnlineImageFromServer
->
elements
.
add
(
ImMsgBody
.
Elem
(
notOnlineImage
=
it
.
delegate
))
is
NotOnlineImageFromServer
->
elements
.
add
(
ImMsgBody
.
Elem
(
notOnlineImage
=
it
.
delegate
))
is
NotOnlineImageFromFile
->
elements
.
add
(
ImMsgBody
.
Elem
(
notOnlineImage
=
it
.
toJceData
()))
is
NotOnlineImageFromFile
->
elements
.
add
(
ImMsgBody
.
Elem
(
notOnlineImage
=
it
.
toJceData
()))
is
AtAll
->
elements
.
add
(
atAllData
)
is
QuoteReply
,
is
QuoteReply
,
is
MessageSource
->
{
is
MessageSource
->
{
...
@@ -295,7 +305,7 @@ internal fun ImMsgBody.SourceMsg.toMessageChain(): MessageChain {
...
@@ -295,7 +305,7 @@ internal fun ImMsgBody.SourceMsg.toMessageChain(): MessageChain {
}
}
@UseExperimental
(
MiraiInternalAPI
::
class
,
ExperimentalUnsignedTypes
::
class
)
@UseExperimental
(
MiraiInternalAPI
::
class
,
ExperimentalUnsignedTypes
::
class
,
MiraiDebugAPI
::
class
)
internal
fun
List
<
ImMsgBody
.
Elem
>.
joinToMessageChain
(
message
:
MessageChain
)
{
internal
fun
List
<
ImMsgBody
.
Elem
>.
joinToMessageChain
(
message
:
MessageChain
)
{
this
.
forEach
{
this
.
forEach
{
when
{
when
{
...
@@ -306,9 +316,18 @@ internal fun List<ImMsgBody.Elem>.joinToMessageChain(message: MessageChain) {
...
@@ -306,9 +316,18 @@ internal fun List<ImMsgBody.Elem>.joinToMessageChain(message: MessageChain) {
if
(
it
.
text
.
attr6Buf
.
isEmpty
())
{
if
(
it
.
text
.
attr6Buf
.
isEmpty
())
{
message
.
add
(
it
.
text
.
str
.
toMessage
())
message
.
add
(
it
.
text
.
str
.
toMessage
())
}
else
{
}
else
{
//00 01 00 00 00 0A 00 3E 03 3F A2 00 00
//00 01 00 00 00 05 01 00 00 00 00 00 00 all
val
id
=
it
.
text
.
attr6Buf
.
read
{
discardExact
(
7
);
readUInt
().
toLong
()
}
//00 01 00 00 00 0A 00 3E 03 3F A2 00 00 one
message
.
add
(
At
(
id
,
it
.
text
.
str
))
val
id
:
Long
it
.
text
.
attr6Buf
.
read
{
discardExact
(
7
)
id
=
readUInt
().
toLong
()
}
if
(
id
==
0L
){
message
.
add
(
AtAll
)
}
else
{
message
.
add
(
At
(
id
,
it
.
text
.
str
))
}
}
}
}
}
}
}
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/GroupMessage.kt
View file @
d365ec5b
...
@@ -14,9 +14,11 @@ import net.mamoe.mirai.contact.Group
...
@@ -14,9 +14,11 @@ import net.mamoe.mirai.contact.Group
import
net.mamoe.mirai.contact.Member
import
net.mamoe.mirai.contact.Member
import
net.mamoe.mirai.contact.MemberPermission
import
net.mamoe.mirai.contact.MemberPermission
import
net.mamoe.mirai.message.data.At
import
net.mamoe.mirai.message.data.At
import
net.mamoe.mirai.message.data.Message
import
net.mamoe.mirai.message.data.MessageChain
import
net.mamoe.mirai.message.data.MessageChain
import
net.mamoe.mirai.utils.getValue
import
net.mamoe.mirai.utils.getValue
import
net.mamoe.mirai.utils.unsafeWeakRef
import
net.mamoe.mirai.utils.unsafeWeakRef
import
kotlin.jvm.JvmName
@Suppress
(
"unused"
,
"NOTHING_TO_INLINE"
)
@Suppress
(
"unused"
,
"NOTHING_TO_INLINE"
)
class
GroupMessage
(
class
GroupMessage
(
...
@@ -37,6 +39,28 @@ class GroupMessage(
...
@@ -37,6 +39,28 @@ class GroupMessage(
inline
fun
At
.
member
():
Member
=
group
[
this
.
target
]
inline
fun
At
.
member
():
Member
=
group
[
this
.
target
]
inline
fun
Long
.
member
():
Member
=
group
[
this
]
inline
fun
Long
.
member
():
Member
=
group
[
this
]
/**
* 给这个消息事件的主体发送引用回复消息
* 对于好友消息事件, 这个方法将会给好友 ([subject]) 发送消息
* 对于群消息事件, 这个方法将会给群 ([subject]) 发送消息
*/
suspend
inline
fun
quoteReply
(
message
:
MessageChain
)
=
reply
(
this
.
message
.
quote
()
+
message
)
suspend
inline
fun
quoteReply
(
message
:
Message
)
=
reply
(
this
.
message
.
quote
()
+
message
)
suspend
inline
fun
quoteReply
(
plain
:
String
)
=
reply
(
this
.
message
.
quote
()
+
plain
)
@JvmName
(
"reply1"
)
suspend
inline
fun
String
.
quoteReply
()
=
quoteReply
(
this
)
@JvmName
(
"reply1"
)
suspend
inline
fun
Message
.
quoteReply
()
=
quoteReply
(
this
)
@JvmName
(
"reply1"
)
suspend
inline
fun
MessageChain
.
quoteReply
()
=
quoteReply
(
this
)
override
fun
toString
():
String
=
override
fun
toString
():
String
=
"GroupMessage(group=${group.id}, senderName=$senderName, sender=${sender.id}, permission=${permission.name}, message=$message)"
"GroupMessage(group=${group.id}, senderName=$senderName, sender=${sender.id}, permission=${permission.name}, message=$message)"
}
}
\ No newline at end of file
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