edisonchee / slimbot

Telegram Bot API for Node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

More examples to the Sending Files Please

suntong opened this issue · comments

Hey @edisonchee,

Please add more examples to the Sending Files demo.

So far it only sends Photos. When I tried to copy and use sendVideo() I got the error of:

error_code":400,"description":"Bad Request: there is no video in the request"}
    at Request.then.resp (/.../node_modules/slimbot/src/telegram.js:61:15)

Are the video/document parameter supposed to be binary strings (obtained from fs.createReadStream)?

Thx

Hi @suntong, thanks for raising this issue. After looking at the source, I realised there are quite a number of bugs that need to be fixed:

  • sendVideo method and other send methods are not making requests with formData
  • it seems like you can no longer pass a fs.readStream object directly to any of the send methods
  • sendFile example code is actually broken

My bad. I'll update you here once I fix the bugs and publish a new release in a bit.

Send methods now make requests with formData if the file you're using is a readable stream.

sendFile no longer broken; let me know if you have any issues using it.

Fantastic! I'll give it a try. THX a lot!