Add quick reference to DSL

This commit is contained in:
Him188 2020-02-12 16:14:27 +08:00
parent eaf3782b5c
commit f91a44ba55

View File

@ -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) })