mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-07 17:50:11 +08:00
Requests input in IO dispatcher
This commit is contained in:
parent
cebd4a8079
commit
97dda77f04
@ -62,9 +62,13 @@ class DefaultLoginSolver(
|
||||
|
||||
@MiraiExperimentalAPI
|
||||
class DefaultLoginSolverImpl(
|
||||
private val input: suspend () -> String,
|
||||
input: suspend () -> String,
|
||||
private val overrideLogger: MiraiLogger? = null
|
||||
) : LoginSolver() {
|
||||
private val input: suspend () -> String = suspend {
|
||||
withContext(Dispatchers.IO) { input() }
|
||||
}
|
||||
|
||||
override suspend fun onSolvePicCaptcha(bot: Bot, data: ByteArray): String? = loginSolverLock.withLock {
|
||||
val logger = overrideLogger ?: bot.logger
|
||||
val tempFile: File = createTempFile(suffix = ".png").apply { deleteOnExit() }
|
||||
|
Loading…
Reference in New Issue
Block a user