|
1 | | -import dev.inmo.micro_utils.coroutines.subscribeSafelyWithoutExceptions |
| 1 | +import dev.inmo.micro_utils.coroutines.subscribeLoggingDropExceptions |
2 | 2 | import dev.inmo.tgbotapi.bot.ktor.telegramBot |
3 | 3 | import dev.inmo.tgbotapi.extensions.api.answers.answer |
4 | 4 | import dev.inmo.tgbotapi.extensions.api.bot.getMe |
@@ -89,7 +89,7 @@ suspend fun activateKeyboardsBot( |
89 | 89 | onCommandWithArgs("inline") { message, args -> |
90 | 90 | val numberArgs = args.mapNotNull { it.toIntOrNull() } |
91 | 91 | val numberOfPages = numberArgs.getOrNull(1) ?: numberArgs.firstOrNull() ?: 10 |
92 | | - val page = numberArgs.firstOrNull() ?.takeIf { numberArgs.size > 1 } ?.coerceAtLeast(1) ?: 1 |
| 92 | + val page = numberArgs.firstOrNull()?.takeIf { numberArgs.size > 1 }?.coerceAtLeast(1) ?: 1 |
93 | 93 | reply( |
94 | 94 | message, |
95 | 95 | replyMarkup = inlineKeyboard { |
@@ -138,7 +138,8 @@ suspend fun activateKeyboardsBot( |
138 | 138 |
|
139 | 139 | onBaseInlineQuery { |
140 | 140 | val page = it.query.takeWhile { it.isDigit() }.toIntOrNull() ?: return@onBaseInlineQuery |
141 | | - val count = it.query.removePrefix(page.toString()).dropWhile { !it.isDigit() }.takeWhile { it.isDigit() }.toIntOrNull() ?: return@onBaseInlineQuery |
| 141 | + val count = it.query.removePrefix(page.toString()).dropWhile { !it.isDigit() }.takeWhile { it.isDigit() } |
| 142 | + .toIntOrNull() ?: return@onBaseInlineQuery |
142 | 143 |
|
143 | 144 | answer( |
144 | 145 | it, |
@@ -170,7 +171,7 @@ suspend fun activateKeyboardsBot( |
170 | 171 |
|
171 | 172 | setMyCommands(BotCommand("inline", "Creates message with pagination inline keyboard")) |
172 | 173 |
|
173 | | - allUpdatesFlow.subscribeSafelyWithoutExceptions(this) { |
| 174 | + allUpdatesFlow.subscribeLoggingDropExceptions(scope = this) { |
174 | 175 | println(it) |
175 | 176 | } |
176 | 177 | }.join() |
|
0 commit comments