Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/add quick reply types #63

Merged
merged 3 commits into from
Mar 10, 2018

Conversation

christophrumpel
Copy link

@christophrumpel christophrumpel commented Mar 9, 2018

This PR adds the possibility to send the new quick reply types location, user_email and user_phone_number. (More info here)

This is how we could send QuickReplies before: (and is still possible)

$bot->reply(Question::create('Question:')->addButton(Button::create('Search')->value('search')));

$bot->reply(Question::create('Question:')->addAction(Button::create('test')->value('test')));

Now you get the same result with the new QuickReplyButton class:

$bot->reply(Question::create('Question:')->addAction(QuickReplyButton::create('Search')->payload('search')));

And additionally now for the new QuickReply types:

$bot->reply(Question::create('How are you doing?')
        ->addAction(QuickReplyButton::create()->type('user_email'))
        ->addAction(QuickReplyButton::create()->type('location'))
        ->addAction(QuickReplyButton::create()->type('user_phone_number')));

What I am not satisfied with is:

  1. Maybe it would be nicer to create own method for createLocation, createUserEmail and createUserPhoneNumber but I tried to make it consistent with other templates and create normally takes the title.

  2. The convertQuestion method from the FacebookDriver now looks a little bit messy because it needs to support both button types. Maybe it would be nicer to use a QuickReply class instead of the Question one. But maybe it is ok so for now.

@codecov
Copy link

codecov bot commented Mar 9, 2018

Codecov Report

Merging #63 into master will increase coverage by 0.7%.
The diff coverage is 94.44%.

Impacted file tree graph

@@            Coverage Diff             @@
##             master     #63     +/-   ##
==========================================
+ Coverage      69.4%   70.1%   +0.7%     
- Complexity      367     379     +12     
==========================================
  Files            33      34      +1     
  Lines           902     930     +28     
==========================================
+ Hits            626     652     +26     
- Misses          276     278      +2
Impacted Files Coverage Δ Complexity Δ
src/FacebookDriver.php 83.13% <100%> (+0.29%) 71 <3> (+4) ⬆️
src/Extensions/QuickReplyButton.php 92% <92%> (ø) 8 <8> (?)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 554540b...9ad965b. Read the comment docs.

@mpociot mpociot merged commit 76fca3c into botman:master Mar 10, 2018
@mpociot
Copy link
Member

mpociot commented Mar 10, 2018

Thank you @christophrumpel !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants