benjick / meteor-telegram-bot

Telegram bot plugin for Meteor
24 stars 15 forks source link

Receive File example #9

Closed sspatank closed 8 years ago

sspatank commented 8 years ago

I have been trying to receive files, and haven't figured that out yet. Telegram only allows you to either send a command or a file. So how can I get this bot to request the file that will be send after the command has been made?

Would I add a nested listener? Do I use the .poll along with a getFile method?

I have a feeling that the getFile method is involved somewhere but I don't know how to get the file_id of the file that will be sent in the next line.

I think an example showing how to receive other forms of media would be really useful.

Thank you for your help.

benjick commented 8 years ago

How does getFile get the file? Do you send it to the bot?

You should be able to TelegramBot.method('getFile', { file_id: theFileId });

sspatank commented 8 years ago

I am confused on that part. I don't know how to get the File_id. I would like to send a file to the bot but I can't put a command in front of it. And hence, I can't add a Listener command.

benjick commented 8 years ago

Hey okay, I figured it out. Doing a quick rewrite of the plugin, I'll let you know when there is a new version up and you can test it

benjick commented 8 years ago

Hey, I monkey patched it in. The code is really ready for some refactoring, but it should work for your purpose now. Check the last example here https://github.com/benjick/meteor-telegram-bot#a-few-examples

Don't forget to update the plugin. Let me know if it works okay.

Cheers

sspatank commented 8 years ago

It worked perfectly. I followed your example and got my project working. Thank you for your help and keep up the great work.

benjick commented 8 years ago

Cool beans! Might be the last update to this plugin. 1.3 brings npm :)