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
da2b279a
Commit
da2b279a
authored
Feb 22, 2020
by
Him188
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
61695743
24eab8f7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
20 deletions
+17
-20
mirai-api-http/EventType_CH.md
mirai-api-http/EventType_CH.md
+0
-0
mirai-api-http/README_CH.md
mirai-api-http/README_CH.md
+1
-1
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
...moe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
+16
-19
No files found.
mirai-api-http/EventType_C
N
.md
→
mirai-api-http/EventType_C
H
.md
View file @
da2b279a
File moved
mirai-api-http/README_CH.md
View file @
da2b279a
...
...
@@ -408,7 +408,7 @@ Content-Type:multipart/form-data
### 事件类型一览
[
事件类型一览
](
./EventType_CN
.md
)
[
事件类型一览
](
EventType_CH
.md
)
> 事件为Bot被动接收的信息,无法主动构建
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
View file @
da2b279a
...
...
@@ -374,12 +374,12 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
// with generic type, less mistakes
private
suspend
fun
<
P
:
Packet
?
>
generifiedParsePacket
(
input
:
Input
)
{
KnownPacketFactories
.
parseIncomingPacket
(
bot
,
input
)
{
packetFactory
:
PacketFactory
<
P
>,
packet
:
P
,
commandName
:
String
,
sequenceId
:
Int
->
handlePacket
(
packetFactory
,
packet
,
commandName
,
sequenceId
)
if
(
packet
is
MultiPacket
<
*
>)
{
packet
.
forEach
{
handlePacket
(
null
,
it
,
commandName
,
sequenceId
)
}
}
handlePacket
(
packetFactory
,
packet
,
commandName
,
sequenceId
)
}
}
...
...
@@ -388,19 +388,31 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
*/
suspend
fun
<
P
:
Packet
?
>
handlePacket
(
packetFactory
:
PacketFactory
<
P
>?,
packet
:
P
,
commandName
:
String
,
sequenceId
:
Int
)
{
// highest priority: pass to listeners (attached by sendAndExpect).
if
(
packet
!=
null
&&
(
bot
.
logger
.
isEnabled
||
logger
.
isEnabled
))
{
val
logMessage
=
"Received: ${packet.toString().replace("
\
n
", """
\
n
""").replace("
\
r
", "")}"
if
(
packet
is
Event
)
{
bot
.
logger
.
verbose
(
logMessage
)
}
else
logger
.
verbose
(
logMessage
)
}
packetListeners
.
forEach
{
listener
->
if
(
listener
.
filter
(
commandName
,
sequenceId
)
&&
packetListeners
.
remove
(
listener
))
{
listener
.
complete
(
packet
)
}
}
// check top-level cancelling
packetFactory
?.
run
{
when
(
this
)
{
is
OutgoingPacketFactory
<
P
>
->
bot
.
handle
(
packet
)
is
IncomingPacketFactory
<
P
>
->
bot
.
handle
(
packet
,
sequenceId
)
?.
sendWithoutExpect
()
}
}
if
(
packet
!=
null
&&
PacketReceivedEvent
(
packet
).
broadcast
().
isCancelled
)
{
return
}
// broadcast
if
(
packet
is
Event
)
{
if
(
packet
is
BroadcastControllable
)
{
if
(
packet
.
shouldBroadcast
)
packet
.
broadcast
()
...
...
@@ -410,21 +422,6 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
if
(
packet
is
CancellableEvent
&&
packet
.
isCancelled
)
return
}
if
(
packet
!=
null
&&
(
bot
.
logger
.
isEnabled
||
logger
.
isEnabled
))
{
val
logMessage
=
"Received: ${packet.toString().replace("
\
n
", """
\
n
""").replace("
\
r
", "")}"
if
(
packet
is
Event
)
{
bot
.
logger
.
verbose
(
logMessage
)
}
else
logger
.
verbose
(
logMessage
)
}
packetFactory
?.
run
{
when
(
this
)
{
is
OutgoingPacketFactory
<
P
>
->
bot
.
handle
(
packet
)
is
IncomingPacketFactory
<
P
>
->
bot
.
handle
(
packet
,
sequenceId
)
?.
sendWithoutExpect
()
}
}
}
/**
...
...
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