Sending a voice message from an OGG file using the InsanusMokrassar/TelegramBotAPI

Advertisements

I am using the InsanusMokrassar/TelegramBotAPI (AKA @ktgbotapi) to make a simple bot that sends random messages to a group of friends. I was wondering, how can I send a voice message starting from an .ogg file I already have that sound inside my package. Now I am trying to use bot.sendVoice() but it asks for a VoiceFile that I don’t know how to create.

>Solution :

you may use sendVoice with InputFile created from MPPFile (common File on JVM) with asMultipartFile extension

Leave a ReplyCancel reply