-
How can I access mp3 or wav file of voice message sended? Or how can I craft it from the raw voice message? Thank you in advance!
|
Beta Was this translation helpful? Give feedback.
Answered by
MKRhere
Feb 16, 2023
Replies: 2 comments
-
#783 (comment) is this an answer?) |
Beta Was this translation helpful? Give feedback.
0 replies
-
Example: import { message } from "telegraf/filters";
bot.on(message("audio"), async ctx => {
const link = await ctx.telegram.getFileLink(ctx.message.audio.file_id);
// link.href is the link to fetch audio from
// use any http client like fetch / axios / ... to fetch the file
const res = await axios(link.href);
// write audio file to disk
fs.writeFileSync("filename.mp3", res.data);
}); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
lofti198
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example: