botman / driver-telegram

BotMan Telegram Driver
MIT License
87 stars 75 forks source link

Add ability to use single-row buttons #31

Closed Lloople closed 6 years ago

Lloople commented 6 years ago

I have an easy question about yes/no and I wanted to show those buttons in a single row.

I have extended the Botman's Question class to add this logic.

Maybe another possible improvement will be to delegate the conversion of question buttons to the Question object itself. That way the conditional will not be needed.

codecov[bot] commented 6 years ago

Codecov Report

Merging #31 into master will increase coverage by 0.01%. The diff coverage is 76.47%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master      #31      +/-   ##
============================================
+ Coverage      77.5%   77.51%   +0.01%     
- Complexity      115      120       +5     
============================================
  Files            11       12       +1     
  Lines           369      387      +18     
============================================
+ Hits            286      300      +14     
- Misses           83       87       +4
Impacted Files Coverage Δ Complexity Δ
src/TelegramDriver.php 92.94% <50%> (-0.52%) 46 <0> (+2)
src/Extensions/Question.php 80% <80%> (ø) 3 <3> (?)

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 a4c86fc...5914156. Read the comment docs.

mpociot commented 6 years ago

Thank you for the PR

I'm not sure if we need a custom Question class for this. You can already achieve this by using the Keyboard + KeyboardButton classes. So I'll skip this for now, as I don't want to have separate Question classes for each driver.

Lloople commented 6 years ago

@mpociot thanks for your reply, I’ll try to implement the way you suggested 🙂

Lloople commented 5 years ago

Hi @mpociot. Reviewing old PR I saw that I already tried something in this direction. I checked those classes you mention Keyboard and KeyboardButton but I cannot understand how to use them. Can you please give me some explanation or example of use? I couldn't find any test either.