mirror of
https://github.com/mamoe/mirai.git
synced 2025-02-10 01:27:01 +08:00
Add quick reference to DSL
This commit is contained in:
parent
eaf3782b5c
commit
f91a44ba55
@ -74,6 +74,10 @@ interface Listener<in E : Event> : CompletableJob {
|
||||
* ```kotlin
|
||||
* bot.subscribe<Subscribe> { /* 一些处理 */ }
|
||||
* ```
|
||||
*
|
||||
* @see subscribeMessages 监听消息 DSL
|
||||
* @see subscribeGroupMessages 监听群消息
|
||||
* @see subscribeFriendMessages 监听好友消息
|
||||
*/
|
||||
inline fun <reified E : Event> CoroutineScope.subscribe(crossinline handler: suspend E.(E) -> ListeningStatus): Listener<E> =
|
||||
E::class.subscribeInternal(Handler { it.handler(it) })
|
||||
|
Loading…
Reference in New Issue
Block a user