justdmitry / NetTelegramBotApi

C# client library for building Telegram bot
MIT License
74 stars 28 forks source link

Send audio as voice message #29

Closed ghost closed 8 years ago

ghost commented 8 years ago

i try to get audio and then send it as voice message. for this,i download the audio by GetFile() and then convert it to .ogg then send it as voice message by SendVoice() But my robot send nothing ! help Please.

justdmitry commented 8 years ago

Any errors returned?

Are you sure that file converted properly - try to send pre-created .ogg file - what result?

ghost commented 8 years ago

thanks. solved. i tried to send .ogg file by SendAudio() and its work ! but when i use SendVoice() telegram send nothing and i give no error !

justdmitry commented 8 years ago

From https://core.telegram.org/bots/api#sendvoice :

For this to work, your audio must be in an .ogg file encoded with OPUS (other formats may be sent as Audio or Document).

Are you sure you have correct .ogg file?