node-telegram-bot-api icon indicating copy to clipboard operation
node-telegram-bot-api copied to clipboard

How to use getFileStream

Open Arjun-M opened this issue 3 years ago • 0 comments

let code = 111 let newFile = JSON.parse( Bot.getFileStream(body.message.reply_to_message.document.file_id ) ) console.log (newFile) let oldFile = JSON.parse( fs.readFileSync( 'server/history/'+code+'.json' , 'utf8')) let merged = { ...newFile , ...oldFile } fs.writeFileSync( 'server/history/'+code+'.json' , JSON.stringify(merged)); return Bot.sendDocument(body.message.from.id , 'server/history/'+code+'.json' , {caption : "Updated Chat History" , parse_mode: "Markdown" } , {contentType: 'application/json' , filename: data.username+".json"})

I tried using this but fails

Arjun-M avatar Feb 15 '22 07:02 Arjun-M