mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI-examples.git
synced 2026-10-26 05:57:09 +00:00
checked 2.1.0 and Bot API 6.1 + update several examples
This commit is contained in:
1 parent
4ae700b58a
commit
0217f97014
4 files changed
+43
-11
No files matched your search
@@ -20,11 +20,9 @@ suspend fun main(args: Array<String>) {
|
||||
telegramBotWithBehaviourAndLongPolling(botToken, CoroutineScope(Dispatchers.IO)) {
|
||||
onMedia(initialFilter = null) {
|
||||
val pathedFile = bot.getFileAdditionalInfo(it.content.media)
|
||||
val file = File(directoryOrFile, pathedFile.filePath.filenameFromUrl).apply {
|
||||
createNewFile()
|
||||
writeBytes(bot.downloadFile(pathedFile))
|
||||
}
|
||||
reply(it, "Saved to ${file.absolutePath}")
|
||||
val outFile = File(directoryOrFile, pathedFile.filePath.filenameFromUrl)
|
||||
bot.downloadFile(it.content.media, outFile)
|
||||
reply(it, "Saved to ${outFile.absolutePath}")
|
||||
}
|
||||
onContentMessage { println(it) }
|
||||
}.second.join()
|
||||
|
||||
Reference in new issue
Block a user