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
cebdd40e
Commit
cebdd40e
authored
Feb 16, 2020
by
HoshinoTented
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add incoming channel
parent
9c74e27d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/MessageSubscribers.kt
...onMain/kotlin/net.mamoe.mirai/event/MessageSubscribers.kt
+13
-0
No files found.
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/MessageSubscribers.kt
View file @
cebdd40e
...
...
@@ -12,6 +12,8 @@
package
net.mamoe.mirai.event
import
kotlinx.coroutines.CoroutineScope
import
kotlinx.coroutines.channels.Channel
import
kotlinx.coroutines.channels.ReceiveChannel
import
net.mamoe.mirai.Bot
import
net.mamoe.mirai.contact.isAdministrator
import
net.mamoe.mirai.contact.isOperator
...
...
@@ -125,6 +127,17 @@ inline fun <R> Bot.subscribeFriendMessages(crossinline listeners: MessageSubscri
}.
run
(
listeners
)
}
/**
* 返回一个指定事件的接收通道
*/
inline
fun
<
reified
E
:
Event
>
Bot
.
incoming
():
ReceiveChannel
<
E
>
{
return
Channel
<
E
>(
8
).
apply
{
subscribeAlways
<
E
>
{
send
(
this
)
}
}
}
/**
* 消息事件的处理器.
...
...
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