diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/internal/InternalEventListeners.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/internal/InternalEventListeners.kt index c88692881..cb99ae7c7 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/internal/InternalEventListeners.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/internal/InternalEventListeners.kt @@ -15,10 +15,7 @@ import kotlinx.coroutines.sync.Mutex import kotlinx.coroutines.sync.withLock import net.mamoe.mirai.event.* import net.mamoe.mirai.event.events.BotEvent -import net.mamoe.mirai.utils.LockFreeLinkedList -import net.mamoe.mirai.utils.MiraiExperimentalAPI -import net.mamoe.mirai.utils.MiraiInternalAPI -import net.mamoe.mirai.utils.MiraiLogger +import net.mamoe.mirai.utils.* import kotlin.coroutines.CoroutineContext import kotlin.coroutines.coroutineContext import kotlin.jvm.JvmField @@ -40,6 +37,20 @@ internal fun , E : Event> KClass.subscribeInternal(listen } +@PlannedRemoval("1.2.0") +@Suppress("FunctionName", "unused") +@Deprecated("for binary compatibility", level = DeprecationLevel.HIDDEN) +internal fun CoroutineScope.Handler( + coroutineContext: CoroutineContext, + concurrencyKind: Listener.ConcurrencyKind, + handler: suspend (E) -> ListeningStatus +): Handler { + @OptIn(ExperimentalCoroutinesApi::class) // don't remove + val context = this.newCoroutineContext(coroutineContext) + return Handler(context[Job], context, handler, concurrencyKind, Listener.EventPriority.NORMAL) +} + + @Suppress("FunctionName") internal fun CoroutineScope.Handler( coroutineContext: CoroutineContext,