File tree Expand file tree Collapse file tree
src/main/kotlin/io/github/gnuf0rce/mirai/netdisk/command Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,10 +16,13 @@ internal object BaiduOAuthCommand : CompositeCommand(
1616) {
1717 private val logger by NetDiskFileSyncPlugin ::logger
1818
19- private suspend fun CommandSender.read ( ): String {
19+ private suspend fun CommandSender.requestInput ( hint : String ): String {
2020 return when (this ) {
21- is ConsoleCommandSender -> MiraiConsole .requestInput(" " )
22- is CommandSenderOnMessage <* > -> fromEvent.nextMessage().content
21+ is ConsoleCommandSender -> MiraiConsole .requestInput(hint)
22+ is CommandSenderOnMessage <* > -> {
23+ sendMessage(hint)
24+ fromEvent.nextMessage().content
25+ }
2326 else -> throw IllegalStateException (" 未知环境 $this " )
2427 }
2528 }
@@ -28,8 +31,7 @@ internal object BaiduOAuthCommand : CompositeCommand(
2831 suspend fun CommandSender.oauth () {
2932 NetDisk .runCatching {
3033 authorize { url ->
31- sendMessage(" 请打开连接,然后在十分钟内输入获得的认证码, $url " )
32- read()
34+ requestInput(" 请打开连接,然后在十分钟内输入获得的认证码, $url " )
3335 } to user()
3436 }.onSuccess { (token, user) ->
3537 logger.info { " 百度云用户认证成功, ${user.baiduName} by $token " }
You can’t perform that action at this time.
0 commit comments