mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI-examples.git
synced 2024-06-02 07:55:14 +00:00
11 lines
297 B
Kotlin
11 lines
297 B
Kotlin
|
import dev.inmo.micro_utils.common.MPPFile
|
||
|
import java.io.File
|
||
|
|
||
|
actual fun pickFile(currentRoot: MPPFile): File? {
|
||
|
if (currentRoot.isFile) {
|
||
|
return currentRoot
|
||
|
} else {
|
||
|
return pickFile(currentRoot.listFiles() ?.takeIf { it.isNotEmpty() } ?.random() ?: return null)
|
||
|
}
|
||
|
}
|