claudiajs / claudia-bot-builder

Create chat bots for Facebook Messenger, Slack, Amazon Alexa, Skype, Telegram, Viber, Line, GroupMe, Kik and Twilio and deploy to AWS Lambda in minutes
https://claudiajs.com/claudia-bot-builder.html
MIT License
1.84k stars 254 forks source link

Telegram extend #28

Closed skylinezum closed 8 years ago

skylinezum commented 8 years ago
stojanovic commented 8 years ago

@skylinezum hey, it seems tests are failing, can you please check why? I don't see anything useful in travis message.

skylinezum commented 8 years ago

Hi @stojanovic I asked @gojko and he said that jasmine reporter is updated, so I will update from master and try to get the reporter to show..

stojanovic commented 8 years ago

Thanks @skylinezum :)

simalexan commented 8 years ago

@skylinezum just one additional, did you try this out locally, on all three types of messages?

simalexan commented 8 years ago

@skylinezum could you also add a test for the case you added?

gojko commented 8 years ago

To keep the response structure consistent with the other bots, I propose that instead of packing method and other properties together, we allow the users to reply with an object including method and body, so if the response is a string we do special processing, but if the response is an object, we just use the body subkey, instead of copying and filtering the method parameter to get the body

skylinezum commented 8 years ago

@gojko Yea, I think having a separate method key and body key makes sense. I'll make changes when I get the chance. @stojanovic Ok I'll put a blank text key and keep them the same. I'll also add tests. I've tested it for what I'm using, but when I have time I'll make the tests better. Thanks for the feedback.

stojanovic commented 8 years ago

@skylinezum hey, I'll close this PR because this will be on NPM later today. Here's what I did:

  1. If you send just text it'll send text message via the same message
  2. If you send something like { text: 'something', parse_mode: 'Markdown' } it'll send that custom message via the same method, it'll add chat id automatically if you don't pass it
  3. If you send something like { method: 'sendMessage', body: { text: '...' } } it'll overwrite the method and apply the same for body as in case 2.

Hope that works :)

skylinezum commented 8 years ago

Yea, that works. Thanks!

stojanovic commented 8 years ago

@skylinezum https://github.com/claudiajs/claudia-bot-builder/releases/tag/v1.4.5