mirror of
https://github.com/mamoe/mirai.git
synced 2025-05-06 05:52:33 +08:00
Improve SeleniumLoginSolver loading
This commit is contained in:
parent
e9e9a12137
commit
9ba4a99cb1
@ -10,13 +10,19 @@
|
||||
package net.mamoe.mirai.utils.internal
|
||||
|
||||
import net.mamoe.mirai.utils.LoginSolver
|
||||
import net.mamoe.mirai.utils.MiraiLogger
|
||||
|
||||
internal val SeleniumLoginSolver: LoginSolver? by lazy {
|
||||
runCatching {
|
||||
try {
|
||||
Class.forName("net.mamoe.mirai.selenium.SeleniumLoginSolver")
|
||||
.getMethod("getInstance")
|
||||
.invoke(null) as? LoginSolver
|
||||
}.getOrNull()
|
||||
} catch (ignore: ClassNotFoundException) {
|
||||
null
|
||||
} catch (error: Throwable) {
|
||||
MiraiLogger.TopLevel.warning("Error in loading mirai-login-solver-selenium, skip", error)
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
// null -> 该情况为 user 确认能自己传入 ticket, 不需要 Selenium 的帮助
|
||||
|
Loading…
Reference in New Issue
Block a user