How to save audio message #237
-
Is there any way to read the bytes from an audio message? |
Beta Was this translation helpful? Give feedback.
Answered by
HeySreelal
Feb 22, 2023
Replies: 1 comment 1 reply
-
Hey again 👋 Yesss you can do this. Here's the code snippet you're looking for: teledart.onMessage().listen((msg) async {
if (msg.audio == null) return;
final aud = msg.audio!;
final file = await teledart.getFile(aud.fileId);
String url =
"https://api.telegram.org/file/bot${envVars['BOT_TOKEN']}/${file.filePath}";
final res = await http.get(Uri.parse(url));
final bytes = res.bodyBytes; // Uint8List - byte data of the audio file.
}); |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
busslina
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey again 👋
Yesss you can do this. Here's the code snippet you're looking for: