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
e580992e
Commit
e580992e
authored
Feb 21, 2020
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix At
parent
4f6691ac
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
14 deletions
+29
-14
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/messages.kt
...Main/kotlin/net/mamoe/mirai/qqandroid/message/messages.kt
+17
-8
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.kt
...ndroid/network/protocol/packet/chat/receive/MessageSvc.kt
+6
-2
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/MessagePacket.kt
...ommonMain/kotlin/net.mamoe.mirai/message/MessagePacket.kt
+2
-2
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/AtAll.kt
...c/commonMain/kotlin/net.mamoe.mirai/message/data/AtAll.kt
+4
-2
No files found.
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/messages.kt
View file @
e580992e
...
...
@@ -28,12 +28,13 @@ internal fun At.toJceData(): ImMsgBody.Text {
return
ImMsgBody
.
Text
(
str
=
text
,
attr6Buf
=
buildPacket
{
writeShort
(
1
)
writeShort
(
0
)
writeShort
(
text
.
length
.
toShort
())
writeByte
(
1
)
writeInt
(
target
.
toInt
())
writeShort
(
0
)
// MessageForText$AtTroopMemberInfo
writeShort
(
1
)
// const
writeShort
(
0
)
// startPos
writeShort
(
text
.
length
.
toShort
())
// textLen
writeByte
(
0
)
// flag, may=1
writeInt
(
target
.
toInt
())
// uin
writeShort
(
0
)
// const
}.
readBytes
()
)
}
...
...
@@ -207,7 +208,15 @@ notOnlineImage=NotOnlineImage#2050019814 {
private
val
atAllData
=
ImMsgBody
.
Elem
(
text
=
ImMsgBody
.
Text
(
str
=
"@全体成员"
,
attr6Buf
=
"00 01 00 00 00 05 01 00 00 00 00 00 00"
.
hexToBytes
()
attr6Buf
=
buildPacket
{
// MessageForText$AtTroopMemberInfo
writeShort
(
1
)
// const
writeShort
(
0
)
// startPos
writeShort
(
"@全体成员"
.
length
.
toShort
())
// textLen
writeByte
(
1
)
// flag, may=1
writeInt
(
0
)
// uin
writeShort
(
0
)
// const
}.
readBytes
()
)
)
...
...
@@ -225,7 +234,7 @@ internal fun MessageChain.toRichTextElems(): MutableList<ImMsgBody.Elem> {
this
.
forEach
{
when
(
it
)
{
is
PlainText
->
elements
.
add
(
ImMsgBody
.
Elem
(
text
=
ImMsgBody
.
Text
(
str
=
it
.
stringValue
)))
is
At
->
elements
.
add
(
ImMsgBody
.
Elem
(
text
=
it
.
toJceData
()))
is
At
->
elements
.
add
(
ImMsgBody
.
Elem
(
text
=
it
.
toJceData
()))
.
also
{
elements
.
add
(
ImMsgBody
.
Elem
(
text
=
ImMsgBody
.
Text
(
str
=
" "
)))
}
is
CustomFaceFromFile
->
elements
.
add
(
ImMsgBody
.
Elem
(
customFace
=
it
.
toJceData
()))
is
CustomFaceFromServer
->
elements
.
add
(
ImMsgBody
.
Elem
(
customFace
=
it
.
delegate
))
is
NotOnlineImageFromServer
->
elements
.
add
(
ImMsgBody
.
Elem
(
notOnlineImage
=
it
.
delegate
))
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.kt
View file @
e580992e
...
...
@@ -263,6 +263,9 @@ internal class MessageSvc {
override
fun
toString
():
String
=
"MessageSvc.PbSendMsg.Response.SUCCESS"
}
/**
* 121: 被限制? 个别号才不能发
*/
data class
Failed
(
val
resultType
:
Int
,
val
errorCode
:
Int
,
val
errorMessage
:
String
)
:
Response
()
{
override
fun
toString
():
String
=
"MessageSvc.PbSendMsg.Response.Failed(resultType=$resultType, errorCode=$errorCode, errorMessage=$errorMessage)"
...
...
@@ -352,13 +355,12 @@ internal class MessageSvc {
):
OutgoingPacket
=
buildOutgoingUniPacket
(
client
)
{
val
source
=
MessageSourceFromSend
(
messageUid
=
Random
.
nextInt
().
absoluteValue
.
toLong
()
and
0
xffffffff
,
messageUid
=
Random
.
nextInt
().
absoluteValue
.
toLong
(),
senderId
=
client
.
uin
,
time
=
currentTimeSeconds
+
client
.
timeDifference
,
groupId
=
groupCode
,
sourceMessage
=
message
)
message
.
addOrRemove
(
source
)
///writeFully("0A 08 0A 06 08 89 FC A6 8C 0B 12 06 08 01 10 00 18 00 1A 1F 0A 1D 12 08 0A 06 0A 04 F0 9F 92 A9 12 11 AA 02 0E 88 01 00 9A 01 08 78 00 F8 01 00 C8 02 00 20 9B 7A 28 F4 CA 9B B8 03 32 34 08 92 C2 C4 F1 05 10 92 C2 C4 F1 05 18 E6 ED B9 C3 02 20 89 FE BE A4 06 28 89 84 F9 A2 06 48 DE 8C EA E5 0E 58 D9 BD BB A0 09 60 1D 68 92 C2 C4 F1 05 70 00 40 01".hexToBytes())
...
...
@@ -380,6 +382,8 @@ internal class MessageSvc {
msgVia
=
1
)
)
message
.
addOrRemove
(
source
)
}
override
suspend
fun
ByteReadPacket
.
decode
(
bot
:
QQAndroidBot
):
Response
{
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/MessagePacket.kt
View file @
e580992e
...
...
@@ -112,9 +112,9 @@ abstract class MessagePacketBase<TSender : QQ, TSubject : Contact>(_bot: Bot) :
/**
* 创建 @ 这个账号的消息. 当且仅当消息为群消息时可用. 否则将会抛出 [IllegalArgumentException]
*/
inline
fun
QQ
.
at
():
At
=
At
(
this
as
?
Member
?:
error
(
"`QQ.at` can only be used in GroupMessage"
))
fun
QQ
.
at
():
At
=
At
(
this
as
?
Member
?:
error
(
"`QQ.at` can only be used in GroupMessage"
))
inline
fun
At
.
member
():
Member
=
(
this
@MessagePacketBase
as
?
GroupMessage
)
?.
group
?.
get
(
this
.
target
)
?:
error
(
"`At.member` can only be used in GroupMessage"
)
fun
At
.
member
():
Member
=
(
this
@MessagePacketBase
as
?
GroupMessage
)
?.
group
?.
get
(
this
.
target
)
?:
error
(
"`At.member` can only be used in GroupMessage"
)
// endregion
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/AtAll.kt
View file @
e580992e
...
...
@@ -16,7 +16,9 @@ import kotlin.jvm.JvmMultifileClass
import
kotlin.jvm.JvmName
/**
* "@全体成员"
* "@全体成员".
*
* 非会员每天只能发送 10 次 [AtAll]. 超出部分会被以普通文字看待.
*
* @see At at 单个群成员
*/
...
...
@@ -26,7 +28,7 @@ object AtAll : Message, Message.Key<AtAll> {
// 自动为消息补充 " "
override
fun
followedBy
(
tail
:
Message
):
MessageChain
{
if
(
tail
is
PlainText
&&
tail
.
stringValue
.
startsWith
(
' '
))
{
if
(
tail
is
PlainText
&&
tail
.
stringValue
.
startsWith
(
' '
))
{
return
super
.
followedBy
(
tail
)
}
return
super
.
followedBy
(
PlainText
(
" "
))
+
tail
...
...
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