update up to 0.35.9

This commit is contained in:
2021-09-21 23:22:13 +06:00
parent 16c27fa493
commit 6aa7fe151e
6 changed files with 29 additions and 51 deletions
FSMBot/src/main/kotlin
FilesLoaderBot/src/main/kotlin
ForwardInfoSenderBot/src/main/kotlin
RandomFileSenderBot/src/main/kotlin
ResenderBot/ResenderBotLib/src/commonMain/kotlin
gradle.properties

@ -36,7 +36,7 @@ suspend fun main(args: Array<String>) {
if (currentRoot.isFile) {
return currentRoot
} else {
return pickFile(currentRoot.listFiles() ?.random() ?: return null)
return pickFile(currentRoot.listFiles() ?.takeIf { it.isNotEmpty() } ?.random() ?: return null)
}
}
@ -76,8 +76,10 @@ suspend fun main(args: Array<String>) {
}
}
sendFiles(message.chat, chosen)
sent || chosen.isNotEmpty()
if (chosen.isNotEmpty()) {
sendFiles(message.chat, chosen)
sent = true
}
if (!sent) {
bot.reply(message, "Nothing selected :(")